program
#include <stdio.h>
#include <conio.h>
void main()
{
int a, cube;
printf("enter a value of a to print a cube: ");
scanf("%d", &a);
for (int i = 1; i <= a; i++)
{
cube = i * i * i;
printf("the cube of %d is %d \n", i, cube);
}
getch();
}
OUTPUT
Enter a value of a to print a cube: 5
The cube of 1 is 1
the cube of 2 is 8
The cube of 3 is 27
The cube of 4 is 64
the cube of 5 is 125
0 Comments