Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
display
#include<stdio.h>
#include<conio.h>
int main()
{
int n,i,sum=0;
printf("enter the numbers you want to display:");
scanf("%d",&n);
for (i=1;i<=n;i++)
{
printf("%d\t",i);
sum=sum+i;
}
printf("\nthe sum from 1 to %d = %d",n,sum);
getch();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.