UAB – 2005: Problem 4: Push Ups with Blaze

At UAB football games, Blaze does push ups after each Blazer score. After the first Blazer touchdown (and point after), Blaze does 7 push ups. After the second touchdown and point after, the score is now 14 and Blaze does 14 push ups.

Write a program that calculates how many total push ups Blaze does during the whole game. Assume that only 7 point touchdowns (including the point after) occur. Prompt for the final score and print out how many push ups Blaze has done.

Example 1:
Enter final score: 21
Push ups: 42

Example 2:
Enter final score: 7
Push ups: 7

Enter final score: 0
Push ups: 0

Enter final score: 14
Push ups: 21

Enter final score: 28
Push ups: 70

Enter final score: 35
Push ups: 105

Enter final score: 42
Push ups: 147


#include <cstdio>

using namespace std;

int main (int argc, char *argv [])
    int finalScore;
    printf ("Enter final score: ");
    scanf ("%d", &finalScore);
    int pushUps = 0;
    for ( int i = 7; i <= finalScore; i = i + 7 )
        pushUps = pushUps + i;
    printf ( "Push ups: %d\n", pushUps );
    return 0;



3 thoughts on “UAB – 2005: Problem 4: Push Ups with Blaze

  1. this a typical beginner’s program for this problem:

    int main()
    int score,i,pushup=0;
    printf(“please enter the final score: “);
    printf(" please enter a multiple of 7.\n");
    printf("the total number of push-ups is %d",pushup);
    return 0;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s