Professional Documents
Culture Documents
Lab-2
different arithmetic
operator.(“+”,”-”,”*”,”/”,”%”)
#include <stdio.h>
int main()
int a,b,c,d,reversed ;
scanf("%d" , &a);
b = a%10 ;
a = a/10 ;
c = a%10 ;
d = a/10 ;
reversed = (b*100)+(c*10)+d ;
printf("\n------------------------------");
return 0;
}
--------------------------------------------------------------------------
Cities in Celsius.
#include<stdio.h>
int main( )
float x,y,c,d;
scanf("%f",&x);
scanf("%f",&y);
c=0.56*(y-32);
d=c-x;
#include <stdio.h>
#include <math.h>
int main()
printf("\n--------------------------------------");
area = 32000 ;
x = area/3.14 ;
radius = sqrt(x);
cf = (2*3.14*radius*5)/1000 ;
return 0;
-----------------------------------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
Int main()
Int a,b,temp;
Scanf(“%d”,&a);
Scanf(“%d”,&b);
Temp = b;
B = a;
A = temp;
#include <stdio.h>
#include <stdlib.h>
Int main()
Int a,b;
Scanf(“%d”,&a);
Scanf(“%d”,&b);
A = a+b;
B = a-b;
A = a-b;
Return 0;
}
(b) A company has following scheme for payment to their staff.
• Deduction = Insurance + PF
• Medical = 4% of Basic
• Insurance = 7% of Gross
#include<stdio.h>
#include<conio.h>
int main()
scanf("%f", &basic);
da=0.5*basic;
printf("¥nThe Dearness Allowance (DA)= %f¥n",da);
hra=0.1*basic;
medical=0.04*basic;
gross_salary=basic+da+hra+medical;
pf=0.05*gross_salary;
insurance=0.07*gross_salary;
deduction=insurance+pf;
net_salary=gross_salary-deduction;
return 0;
}
------------------------------------------------------------------------------------------------------
paise.
#include<stdio.h>
#include<stdlib.h>
int main()
float x;
int r,p;
scanf("%f",&x);
r = (int)x;
p = 100*(x-r);
return 0;
#include<stdio.h>
int main()
int a,b,c;
scanf("%d",&a);
scanf("%d",&b);
if(a>b)
return 0;
2.
#include <stdio.h>
Int main() {
// if n1 is
Return 0;
-----------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
Int main()
Float p, r, t, si;
Scanf(“%f”, &r);
Scanf(“%f”, &t);
Si=(p*r*t)/100;
Return 0;
* Thank you *