Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // this program uses a count controlled loop to count the sum of 5 entered digits
- #include <stdio.h>
- int counter, num, total;
- int main(void) {
- printf("This program calculates the sum of five numbers \n\n");
- for (counter = 1; counter <= 5; counter ++) {
- printf("Enter a number\n");
- scanf_s("%d", &num);
- total = num + total;
- }
- printf("The sum of the five numbers that you entered is %d \n", total);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement