#include<stdio.h> int main() { int a; int sum=0; int i; printf("upto how many terms u want to be summed : "); scanf("%d",&a); for(i=1;i<=a;i++){ sum+=i; } printf("sum is %d",sum); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter