Search This Blog

Friday, August 19, 2016

HOW TO WRITE A PROGRAM FOR FIND A VOLUME OF A CUBE IN C PROGRAMMING



                This is a simple program to find a volume of a cube.


                     Program code :


                                      #include <stdio.h>

                                        int main(void)
                               {
                                        int length, width, hight;

                                       printf("\n Please Enter Your Length: ");
                                       scanf("%d", &length);
                                       printf("\n Please Enter Your Width: ");
                                       scanf("%d", &width);
                                       printf("\n Please Enter Your Hight: ");
                                       scanf("%d", &hight);

                                       printf("\n Your Volume is: %d \n", length * width * hight );

                                       return 0;

                                                          }


Output


[N.B: We know that volume of a cube "V = A^3" or "V = A x A x A" , just do here in C code.]






No comments:

Post a Comment