C Program To Read Integer (N) And Print First Three Powers (N^1,N^2,N^3)
belongs to collection: Basic C Programs for Practice
All Answers
need an explanation for this answer? contact us directly to get an explanation for this answer
Simple Without Using Power Function
#include<stdio.h>
#include<math.h>
int main()
{
int num;
printf("\nEnter The Number .\n");
scanf("%d",&num);
printf("\nOutput Is\n\n");
printf("%d ,%d ,%d \n\n",num,num*num,num*num*num);
return 0;
}
Output:
Enter the Number.
5
Output Is
5 ,25 ,125
need an explanation for this answer? contact us directly to get an explanation for this answertotal answers (2)
Using Power Function
Output:
Enter the Number.
10
Output Is
10 ,100 ,1000
need an explanation for this answer? contact us directly to get an explanation for this answer