Advertisement

This program will Output : 1+2+3+4+…………………………….+100


#include<stdio.h>
#include<conio.h>
void main()
{ clrscr();
  int s,i;
  printf("Enter value=");
  scanf("%d",&s);
  i=1;
  while(i<=100)
  { s=s+i;
  i=i+1;
  }
  printf("Result=%d",s);
  getch();

}

No comments:

Post a Comment

Please comment bellow. Share your knowledge