1.
#include <stdio.h>
int main()
{
int
a,b;
printf("\nEnter
the meter value : ");
scanf("%i",
&a);
b =
a*100;
printf("The
centimeter value is %icm", b);
return
0;
}
2.
#include <stdio.h>
#define PI 3.142
int main()
{
float
r, h;
printf("\nEnter
the radius : ");
scanf("%f",
&r);
printf("\nEnter
the height : ");
scanf("%f",
&h);
printf("\nVolume is %f", PI*r*r*h);
return
0;
}
3.
#include <stdio.h>
int main()
{
float mark1, mark2, mark3, mark4, total, average;
printf("\nEnter the subject 1 mark : ");
scanf("%f", &mark1);
printf("\nEnter the subject 2 mark : ");
scanf("%f", &mark2);
printf("\nEnter the subject 3 mark : ");
scanf("%f", &mark3);
printf("\nEnter the subject 4 mark : ");
scanf("%f", &mark4);
total = mark1+mark2+mark3+mark4;
average = total/4;
printf("\nAverage is %.2f", average);
return 0;
}
4.
#include <stdio.h>
int main()
{
float Tc, Tf;
printf("\nEnter temparature in celsius : ");
scanf("%f",&Tc);
Tf = (Tc*1.8)+32;
printf("\nTemperature in fahrenheit is %.2f", Tf);
return 0;
}
5.
#include <stdio.h>
int main()
{
float x, y;
x = 5.23;
y = 3.5*x +5;
printf("\nValue of y is %.2f", y);
return 0;
}
6.
#include <stdio.h>
int main()
{
float
i, c;
printf("\nEnter
the value in inches : ");
scanf("%f",
&i);
c = i*2.54;
printf("\nThe centimeter value is %.2fcm", c);
return
0;
}
0 Comments
Post a Comment