Monday, January 5, 2015

Find Area of Parallelogram and Surface Area of Cuboids and cone in c pro



Find Area of Parallelogram
 
#include 
#include 
int main()
{
    float base, altitude;
    float area;
    clrscr();
   printf("Enter base and altitude of the given Parallelogram: \n ");
    scanf("%f%f", &base, &altitude);
    area = base * altitude;
    printf("Area of Parallelogram is: %.3f\n", area);
    return 0;
    getch();
}

Output
 
Enter base and altitude of the given Parallelogram:
 17 19
Area of Parallelogram is: 323.000
 
Find the Volume and Surface Area of Cuboids
 
#include 
#include 
#include 
int main()
{
    float width, length, height;
    float surfacearea, volume, space_diagonal;
   clrscr(); 
   printf("Enter value of width, length & height of the cuboids:\n");
    scanf("%f%f%f", &width, &length, &height);
    surfacearea = 2 *(width * length + length * height +
    height * width);
    volume = width * length * height;
    space_diagonal = sqrt(width * width + length * length +
    height * height);
    printf("Surface area of cuboids is: %.3f", surfacearea);
    printf("\n Volume of cuboids is : %.3f", volume);
    printf("\n Space diagonal of cuboids is : %.3f", space_diagonal);
    return 0;
getch();
}
 
Output
 
Enter value of width, length & height of the cuboids :
 22 23 24
Surface area of cuboids is: 3172.000
Volume of cuboids is : 12144.000
Space diagonal of cuboids is : 39.862
 
Find the volume and surface area of cone
 
#include 
#include 
#include 
int main()
{
    float radius, height;
    float surface_area, volume;
    clrscr();
    printf("Enter value of radius and height of a cone :\n ");
    scanf("%f%f", &radius, &height);
    surface_area = (22 / 7) * radius * (radius + sqrt(radius * radius + height * height));
    volume = (1.0/3) * (22 / 7) * radius * radius * height;
    printf("Surface area of cone is: %.3f", surface_area);
    printf("\n Volume of cone is : %.3f", volume);
    return 0;
    getch();
}
 
Output
 
Enter value of radius and height of a cone :
 6 9
Surface area of cone is: 302.700
             Volume of cone is : 324.000

No comments:

Post a Comment