-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathq1 studens.txt
36 lines (27 loc) · 1.03 KB
/
q1 studens.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//pritpal Singh
#include<iostream>
using namespace std;
int main()
{
int numStudents;
int workdays;
float numHours, total, average;
int student ,day=0;// these are the counters for the loops
cout<<"This program will find the average number of hours a day "<<" that a student spent programming over long weekend\n\n";
cout<<"How many students are there ?"<<endl<<endl;
cin>>numStudents;
cout<<"Enter the number of days in long weekend work by student"<<endl;
cin>>workdays;
for(student=1;student<=numStudents;student++)
{
total=0;
for(day=1;day<=workdays;day++)
{
cout<<"please enter the number of hours worked by student "<<student<< "on day " <<day <<"."<<endl;
cin>>numHours;
total=total+numHours;
}
average=total/3;
cout<<endl;
cout<<"The average number of hours per day spent programming by "<<"student "<<student<<" is " <<average<<endl<<endl<<endl;
}