Hello,
these are my first steps in C.
I need some help in the following code:
Code:#include <stdio.h> #include <stdlib.h> main() { int n,i,j,t; printf("Enter N:"); scanf("%d", &n); i=2; while(i<=n) { j=2; while(j<=i) { if(i%j==0) { t=i/j; printf("%d ",t); } j++; } i++; } system("pause"); return 0; }
So far my vars are as:
i j i%j i/j sum group by i
2 2 0 1 1
3 2 1
3 3 0 1
4 2 0 2 3
4 3
4 4 0 1
5 2 1
5 3
5 4
5 5 0 1
6 2 0 3 6
6 3 0 2
6 4
6 5
6 6 0 1
I have manage to display i/j, but I cant make it work for the last column, to add the result of the division where the mod is 0 grouped by i counter.
Any help will be much apreciated.