|
|
back to boardDiscussion of Problem 1068. Sumits working in codeblocks so whats wrong?? Posted by afia 1 Feb 2024 21:33 #include<stdio.h> int main() { int i,n,sum; scanf("%d",&n); if(n>0) { for (i=1;i<=n;i++) { sum=sum+i; } printf("%d",sum); } if(n<0) { for (i=n;i<=1;i++) { sum=sum+i;} printf("%d",sum);} else if(n==0){ printf("not applicable");} } |
|
|