Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program to do the following using loops: A stamp collector collects stam

ID: 3727536 • Letter: W

Question

Write a program to do the following using loops:

A stamp collector collects stamps at the end of each month. Write a program that keeps a running total of the number of stamps collected each month (adding from previous month(s)). The program should ask for the name of the month, and the number of stamps collected that month (for the 12 months out of the year), and when the loop is finished, the program should display the total number of stamps collected for the year.

Data:

January 111

February 46

March      78

April        91

May 5

June        16

July         33

August     46

Sept        77

Oct          23

Nov 40

Dec         13

Explanation / Answer

// you not specify any language type so i am writing in c++.

# include<iostream>

#include<string>

# include<stdio>

using namespace std;

int main(void)

{

int a[12],i,j;

char s[12][10]; \ string to store 12 month name of maximum 10 character.

cout<<"Enter the name of the month:-"<< <<"The number of stamps collected that month=";

for(i=0; i<12; i++)

{

gets( s[i] );

cin>>a[i];

j= j + a[i];

}

cout<<"total number of stamps collected for the year = "<<j<< ;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote