What's wrong with my "input number of terms", why is 8, but my input is 5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's wrong with my "input number of terms", why is 8, but my input is 5

#include <stdio.h> //display the cube of the number upto a given integer. void main() { int i, ctr; printf("Input number of terms:%d \n", ctr); 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)); } }

29th Sep 2019, 4:00 PM
Yilin Lian
Yilin Lian - avatar
0 Answers