Computer Science, asked by yousafkhan, 6 months ago

how to write a program in c++ finde the area of cub?​

Answers

Answered by Imblank
1

Answer:

using namespace std

int side;

cout<<"Enter the side of cube :";

cin>>side;

cout<<"Area of cube is "<<side*side<<"sq.m";

Read my bio once

Answered by PratyushKurup
1

Answer:

Example

Input-: side=3

Output-: volume of cube is: 27

Total surface area of cube is 54

Algorithm

Start

Step 1 -> declare function to find volume of cube

double volume(double a)

return (a*a*a)

Step 2 -> declare function to find area of cube

double volume(double a)

return (6*a*a)

Step 3 -> In main()

Declare variable double a=3

Print volume(a)

Print area(a)

Stop

CODE

#include <bits/stdc++.h>

using namespace std;

// function for volume of cube

double volume(double a){

return (a * a * a);

}

//function for surface area of cube

double area(double a){

return (6 * a * a);

}

int main(){

double a = 3;

cout<< "volume of cube is: "<<volume(a)<<endl;

cout<< "Total surface area of cube is "<<area(a);

return 0;

}

Output

volume of cube is: 27

Total surface area of cube is 54

Similar questions