1:
#include<stdio.h>
///***trapezium
int main(){
float b1,b2,h;
float area;
printf("Enter the size of two bases and height of the trapezium : ");
scanf("%f%f%f",&b1,&b2,&h);
area = 0.5 * ( b1 + b2 ) * h ;
printf("Area of trapezium is: %.2f",area);
return 0;
}
output:depend on your value
2:
#include<stdio.h>
#include<math.h>
///***equilateral triangle
int main(){
float a;
float area;
printf("Enter size of side of the equilateral triangle : ");
scanf("%f",&a);
area = sqrt(3)/4*(a*a);
printf("Area of equilateral triangle is: %.2f",area);
return 0;
}
output:depend on your value
3:
#include<stdio.h>
///***cube surface and volume
int main(){
float a,surface,volume;
printf("Enter size of any side of a cube : ");
scanf("%f",&a);
surface= 6 * (a * a);
volume = a * a * a;
printf("Surface area of cube is: %.2f",surface);
printf("Volume of cube is : %.2f",volume);
return 0;
}
output:depend on your value
3:
#include<stdio.h>
#define PI 3.141
///***perimeter of circle
int main()
{
float r;
printf("Enter the radius value:");
scanf("%f",&r);
printf("Area of circle : %.2f ", PI*r*r);
printf("Perimeter of the circle : %.2f ", 2*PI*r);
return 0;
}
No comments:
Post a Comment