Uploaded by hardsummer17

while loops

advertisement
#include<conio.h>
#include<stdio.h>
void main()
{
int i,y,n;
clrscr();
printf("please enter the number \n");
scanf("%d",&n);
y=0;
i=1;
while(i<=n)
{
y=y+i;
i=i+1;
}
printf("the required sum is %d",y);
getch();
}
Download