write algorithm and draw the flowchart for the following finding the cube of a given number
Answers
Answered by
32
cube = a^3
In this a= any number.
Eg.- find cube of 2
= 2^3
= 2*2*2
=8.
In this a= any number.
Eg.- find cube of 2
= 2^3
= 2*2*2
=8.
Answered by
20
"Steps:
1. Declare the variable of 'a' to get the user input.
2. Get the user input value 'a'.
3. Check whether the given 'a' value is a valid number.
4. Calculate the cube for the given value of 'a'.
5. Print the cube value.
Algorithm:
#include <stdio.h>
#include<math.h>
int main()
{
int n, result;
\\ Assigning the value
printf(“\n Enter the integer required: ”);
scanf(“%d”, &n);
\\ Getting the input from user
cube = n * n * n
printf(“\n The cube value for the given number is: ”, result);
return 0;
}
The flow low chart is given below."
Attachments:
Similar questions