1. Question:C program for area of circle 

    Answer
    #include <stdio.h>
    #define PI 3.141
    int main(){
      float r, a;
      printf("Radius: ");
      scanf("%f", &r);
      a = PI * r * r;
      printf("%f\n", a);
      return 0;
    }

    1. Report
  2. Question:C program for area of a triangle 

    Answer
    #include<stdio.h>
    #include<math.h>
    
    int main(){
       
        float a,b,c;
        float s,area;
       
        printf("Enter size of each sides of triangle");
        scanf("%f%f%f",&a,&b,&c);
       
        s = (a+b+c)/2;
        area = sqrt(s*(s-a)*(s-b)*(s-c));
       
        printf("Area of triangle is: %.3f",area);
       
        return 0;
    }
    Sample output: Enter size of each sides of the triangle: 2 4 5 Area of triangle is: 3.800

    1. Report
  3. Question:C program for area of equilateral triangle 

    Answer
    #include<stdio.h>
    #include<math.h>
    
    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: %.3f",area);
    
        return 0;
    }
    Sample output: Enter size of side of the equilateral triangle: 5 Area of equilateral triangle is: 10.825

    1. Report
  4. Question:C program for area of right angled triangle 

    Answer
    #include<stdio.h>
    int main(){
        float h,w;
        float area;
    
        printf("Enter height and width of the right angled triangle : ");
        scanf("%f%f",&h,&w);
    
        area = 0.5 * h * w;
        printf("Area of right angled triangle is: %.3f",area);
        return 0;
    }
    Sample output: Enter height and width of the right angled triangle: 10 5 Area of right angled triangle is: 25.000

    1. Report
  5. Question:C program for area of a rectangle 

    Answer
    #include<stdio.h>
    
    int main(){
    
        float l,w;
        float area;
    
        printf("Enter size of each sides of the rectangle : ");
        scanf("%f%f",&l,&w);
    
        area = l * w;
        printf("Area of rectangle is: %.3f",area);
    
        return 0;
    }
    [b]Sample output:[b] Enter size of each sides of the rectangle: 5.2 20 Area of rectangle is: 104.000

    1. Report
  6. Question:C program for area of a trapezium 

    Answer
    #include<stdio.h>
    
    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: %.3f",area);
        return 0;
    }
    Sample output: Enter the size of two bases and height of the trapezium: 5 8 3 Area of trapezium is: 19.500

    1. Report
  7. Question:C program for area of a cube 

    Answer
    #include<stdio.h>
    
    int main(){
    
        float a;
        float surface_area,volume;
    
        printf("Enter size of any side of a cube : ");
        scanf("%f",&a);
    
        surface_area = 6 * (a * a);
        volume = a * a * a;
    
        printf("Surface area of cube is: %.3f",surface_area);
        printf("\nVolume of cube is : %.3f",volume);
    
        return 0;
    }
    Sample output: Enter size of any side of a cube: 3 Surface area of cube is: 54.000 Volume of cube is: 27.000

    1. Report
  8. Question:C program for area of a cuboids 

    Answer
    #include<stdio.h>
    int main(){
    
        float w,l,h;
        float surface_area,volume,space_diagonal;
    
        printf("Enter size of width, length and height of a cuboids : ");
        scanf("%f%f%f",&w,&l,&h);
    
        surface_area = 2*(w*l + l*h + h*w);
        volume = w * l * h;
        space_diagonal = sqrt(w*w + l*l + h*h);
    
        printf("Surface area of cuboids is: %.3f",surface_area);
        printf("\nVolume of cuboids is : %.3f",volume);
        printf("\nSpace diagonal of cuboids is : %.3f",space_diagonal);
    
        return 0;
    }
    Sample output: Enter size of width, length and height of cuboids: 5 10 4 Surface area of cuboids is: 220.000 Volume of cuboids is: 200.000 Space diagonal of cuboids is: 11.874

    1. Report
  9. Question:C program for area of a cylinder 

    Answer
    #include<stdio.h>
    #include<math.h>
    
    int main(){
    
        float r,h;
        float surface_area,volume;
    
        printf("Enter size of radius and height of a cylinder : ");
        scanf("%f%f",&r,&h);
    
        surface_area = 2 * M_PI * r * (r + h);
        volume = M_PI * r * r * h;
    
        printf("Surface area of cylinder is: %.3f",surface_area);
        printf("\nVolume of cylinder is : %.3f",volume);
    
        return 0;
    }
    Sample output: Enter size of radius and height of a cylinder: 4 10 Surface area of cylinder is: 351.858 Volume of cylinder is: 502.655

    1. Report
  10. Question:Write a c program or code to find or calculate the volume and surface area of cone 

    Answer
    #include<stdio.h>
    #include<math.h>
    
    int main(){
    
        float r,h;
        float surface_area,volume;
    
        printf("Enter size of radius and height of a cone : ");
        scanf("%f%f",&r,&h);
    
        surface_area = M_PI * r * (r + sqrt(r*r + h*h));
        volume = (1.0/3) * M_PI * r * r * h;
    
        printf("Surface area of cone is: %.3f",surface_area);
        printf("\nVolume of cone is : %.3f",volume);
    
        return 0;
    }
    Sample output: Enter size of radius and height of a cone: 3 10 Surface area of cone is: 126.672 Volume of cone is: 94.248

    1. Report
Copyright © 2024. Powered by Intellect Software Ltd