Write a program to read a number and print the square and cube of that number
Answers
Answered by
3
Explanation:
Accept number of lines (n, integer) from the user.
Pictorial Presentation:
Sample Solution:
C Code: #include <stdio.h> int main() { int a, i, j = 1, x = 0; printf("Input number of lines: "); scanf("%d", &a); for(i = 1; i <= a; i++) { printf("%d %d %d\n", i, i*i, i*i*i); } return 0; } ...
Flowchart:
Answered by
1
INPUT:-
#include <stdio.h> int main() { int a, i, j = 1, x = 0; printf("Input number of lines: "); scanf("%d", &a); for(i = 1; i <= a; i++) { printf("%d %d %d\n", i, i*i, i*i*i); } return 0; }
Input number of lines: 5
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
Similar questions