Rahul wants to find the cube of integers. Help him to develop a program in C to display the
cube of the number up to given an integer using for loop
#include <stdio.h>
void main()
{
int i,ctr;
printf("Input number of terms : ");
scanf("%d", &ctr);
for(i=1;i<=ctr;i++)
{
printf("Number is : %d and cube of the %d is :%d \n",i,i, (i*i*i));
}
}
Comments
Leave a comment