Algorithm to find square &cube of given no.
Home
/
Computer Science
/
Algorithm to find square &cube of given no
Algorithm to find square &cube of given no.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,s,c;
clrscr();
printf("\n Enter A Number: ");
scanf("%d",&a);
s=a*a;
c=s*a;
printf("\n Square of %d is = %d",a,s);
printf("\n\n Cube of %d is = %d",a,c);
getch();
}
Explanation:
square of number = number X number.
Cube of number= square X number.