Print sum of first 100 integers. (With data validation)
1
Expert's answer
2022-03-14T02:37:30-0400
#include <stdio.h>
int main()
{
int sum=0,i;
for(i=1;i<=100;i++){
sum+=i;
}
printf("The sum of first 100 integers is %d\n\n",sum);
scanf("%d", &sum);
return 0;
}
Comments
Leave a comment