Calculate square and calculate cube in cpp program
Answers
Answered by
2
Answer:
#include<stdio.h>
#include<conio.h>
void main()
{
int s,c;
clrscr();
printf("The square is=");
scanf("%ds");
s=s*2;
c=c*3
printf("the answer is -");
getch();
}
Explanation:
Answered by
1
Below are the C++ Program for the above question:
Explanation:
#include <iostream>//Header file.
using namespace std;//package name.
int main()//main function.
{
float number;//variable
cout<<"Enter the number to find square and cube of that number: "; //user message.
cin >>number;//Take a input.
cout<<"The square of a "<<number<<" is: "<<number*number<<" and the cube of a "<<number<<" is: "<<number*number*number;//Print the square and cube of a number.
return 0;
}
Output :
- If the user input as 4 then the output are square="16" and cube="64".
- If the user input as 0.12 then the output are square="0.0144" and cube="0.001728".
Code Explanation :
- The above code is in c++ language which renders a message to the user and then takes the input from the user.
- And then print the square and cube of that number after calculating.
Learn More:
- C++-program : https://brainly.in/question/637147
Similar questions