Squared and Cube numbers

Friday, March 27, 2009, Posted by John, No Comment


Here is the code in getting the squared and cube of a numbers.

Code:

#include..........
#include..........
#include..........

int main()
{
int num1,num2, num[20];

printf("Enter Number to be input:");
scanf("%d",&num2);
num1=0;
while (num1
printf("\tEnter Number: ");
scanf("%d",&num[num1]);
num1++;
}

printf("Number\t\tSquare\t\tcube");

num1=0;
while(num1
printf("\n%d\t\t%d\t\t%d",
num[num1],num[num1]*num[num1],num[num1]*num[num1]*num[num1]);
num1++;
}
getch();
}

Output: