Tuesday, August 21, 2018

PUSH UPS WITH BLAZE

  • Problem Description

    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.
  • CODING ARENA
  • #include <stdio.h>
    int main()
    {
      int a,b,i;
      scanf("%d",&a);
      for(i=7;i<=a;i=i+7)
        b=b+i;
      printf("%d",b);
        
      
    return 0;
    }
  • Test Case 1

    Input (stdin)
    21
    
    
    Expected Output
    42
  • Test Case 2

    Input (stdin)
    28
    
    
    Expected Output
    70

2 comments: