#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,n,tot=0;
printf("Enter any limit :-");
scanf("%d",&n);
for(i=n;i>=1;i--)
{
tot=tot+i;
}
printf("Sum is => %d",tot);
getch();
}
#include<conio.h>
void main()
{
clrscr();
int i,n,tot=0;
printf("Enter any limit :-");
scanf("%d",&n);
for(i=n;i>=1;i--)
{
tot=tot+i;
}
printf("Sum is => %d",tot);
getch();
}
No comments:
Post a Comment