Write a program that displays the sum of numbers between 1 and 100
Difficulty level
This exercise is mostly suitable for students
#include <stdio.h>
#include <conio.h>
void main()
{
int n, tot;
for (tot = 0, n = 1; n<101; n++)
tot += n;
printf("Sum of numbers from 1 to 100 is equal to %d\n", tot);
getch();
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Hashing using linear probing