i have problem with the loop. i want to get the result as: but i cannot find what wrong with the code. please help me.
exp:
4+3+2+1=10
3+2+1=6
2+1=3
1=1
Code:#include<stdio.h> main() { int i,j,count,sum; printf("input number \n"); scanf("%d",&count); for(i=count;i>=1;i--) { sum=i; printf("\n%d",i); j=1; while(i>j) { i--; printf("+%d",i); sum+=i; } printf("=%d",sum); } printf("\n"); }