Imperative Programming



 Note- Handwritten Pdf  Notes link given below 👇



Practicals


P1A : Write a C Program to display the message “HELLO WORD”.


 

#include<stdio.h>

#include<conio.h> 

int main ()

{

   clrscr() ;

   printf (“HELLO WORLD”) ;

 

   getch() ;

}

 

 



 





P1B : Write a  C Program to declare some variables of type int, float, and double. Assign some values to these variables and display these values.


 

 

#include<stdio.h>

#include<conio.h>

 

int main ()

{

   int roll = 10 ;

   float pct = 99.99f ;

   double wt = 55.55 ;

   clrscr() ;

  

   printf (“\n Roll no. of Student is : %d” , roll) ;

   printf (“\n Percentage is : %f” , pct) ;

   printf (“\n Weight is : %e” , wt) ;

  

   getch();

}







P1C : Write a C Program to find the Addition, Subtraction, Multiplication and Division of two numbers.

 

 

#include<stdio.h>

#include<conio.h>

 

int main ()

{

   int num1, num2, add, sub, mul, div ;

   clrscr () ;

  

   printf (“\n Enter first number : ”) ;

   scanf (“%d” , & um1) ;

   printf (“\n Enter second number : ”) ;

   scanf (“%d” , & um2) ;

 

   add = num1 + Num2 ;

   sub = num1 - Num2 ;

   mul = num1 * Num2 ;

   div = num1 / Num2 ;

 

   printf (“\n Addition of  no. is : %d” , add) ;

   printf (“\n Roll no. of Student is : %d” , sub) ;

   printf (“\n Roll no. of Student is : %d” , mul) ;

   printf (“\n Roll no. of Student is : %d” , div) ;

 

   getch();

}


 

 







P2A : Write a program to swap two numbers without using third variable.



#include<stdio.h>

#include<conio.h>

 

int main()

{

int num1, num2;

clrscr();

printf("Enter 1st number : ” );

scanf(“%d”, &num1);

printf("Enter 2nd number : ” );

scanf(“%d”, &num2);

 

printf(“\n~~Before Swapping~~”);

printf(“\n Value of 1st no. is : %d”, num1);

printf(“\n Value of 2nd no. is : %d”, num2);

 

num1 = num1 + num2;

num2 = num1 - num2;

num1 = num1 - num2;

 

printf(“\n~~After Swapping~~”);

printf(“\n Value of 1st no. is : %d”, num1);

printf(“\n Value of 2nd no. is : %d”, num2);

 

getch();

return 0;

}






































P2B : Write a program to find the Area of Rectangle, Square and Circle.


#include<stdio.h>

#include<conio.h>

 

int main()

{

int len, br, area_rec, side, area_aqr, rad;

double area_cir;

clrscr();

 

printf("Enter length : ” );

scanf(“%d”, &len);

printf("Enter breadth : ” );

scanf(“%d”, &br);

area_rec = len * br ;

printf(“\n Area of Rectangle is : %d”, area_rec);

 

printf("Enter side : ” );

scanf(“%d”, &side);

area_sqr = side * side;

printf(“\n Area of Square is : %d”, area_sqr);

 

printf("Enter radius : ” );

scanf(“%d”, &rad);

area_cir = 3.14*rad*rad ;

printf(“\n Area of Circle is : %d”, area_cir);

 

getch();

}







































P2C : Write a program to find the Volume of Cube, Sphare and Cylinder.


#include<stdio.h>

#include<conio.h>

 

int main()

{

int vol_cube, side;

float vol_sphare, rad_sphare, vol_cyl, ht;

clrscr();

 

printf("Enter side of Cube : ” );

scanf(“%d”, &side);

vol_cube = side*side*side;

printf(“\n Volume of Cube is : %d”,  vol_cube);

 

printf("Enter radius of Sphare : ” );

scanf(“%f”, &rad_sphare);

vol_cube = 4/3*3.14*rad_sphare*rad_sphare*rad_sphare;

printf(“\n Volume of Sphare is : %f”,  vol_sphare);

 

printf("Enter radius of Cylinder : ” );

scanf(“%f”, &rad_cyl);

printf("Enter height of Cylinder : ” );

scanf(“%f”, &ht);

vol_cyl = 3.14*rad_cyl*rad_cyl*ht;

printf(“\n Volume of Cylinder is : %f”,  vol_cyl);

 

getch();

}






















































Practical-1 pdf download

Practical-2 pdf download

Practical-3 pdf download

Practical-4 pdf download

Practical-6 pdf download

Practical-7 pdf download

Practical-8 pdf download

Practical-9 pdf download