C Program to calculate square and cube
Question: Write a program which enters any intgers then calculate it's square and cube?// Online C compiler to run C program online
#include <stdio.h>
void main()
{
int a,b,c;
printf("Enter an intger");
scanf("%d",&a);
b=a*a;
printf("square is %d",b);
c=a*a*a;
printf("\n cube is %d",c);
}
...........................................
// Online C compiler to run C program online
// Now Output Chnage
// square of ... is ....
//cube of ... is ....
#include <stdio.h>
void main()
{
int a,b,c;
printf("Enter an intger");
scanf("%d",&a);
b=a*a;
c=a*a*a;
printf("square of %d is %d \n",a,b);
printf("cube of %d is %d",a,c);
}
Categories: c programming c programming