Is something wrong, can I get a hint?) Displays correctly only if I enter 2.
Input example
2
Sample output
12
3 4
The task:
Print the numeric square of the specified size. The displayed numbers start at one and are constantly increasing. In each line numbers are separated by spaces. Size read from the keyboard.
#include <stdio.h> int main() { int total; int temp = 1; scanf("%d", &total); printf("%d ", 1); for ( int i = 0; i < total; i++ ) { for ( int j = 0; j < i; j++ ) { temp += 1; printf("%d ", temp); } temp += 1; printf("%d\n", temp); } return 0; }