-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivity.txt
More file actions
96 lines (76 loc) · 2.6 KB
/
activity.txt
File metadata and controls
96 lines (76 loc) · 2.6 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Activity7 no.l: Make a program that
will input three numbers Num1, Num2,
Num3. Add Numl and Num2. Subtract
Num3 to the Sum of Numl and Num2
Enter Number1: 5
Enter Number2: 10
Enter Number3: 6
Total of Num1 and Num2 is : 15
Subtract Num3 to the total: 9
***************************************************************************************
#include <stdio.h>
int main() {
int num1, num2, num3, sum, result;
printf("Enter Number 1: ");
scanf("%d", &num1);
printf("Enter Number 2: ");
scanf("%d", &num2);
printf("Enter Number 3: ");
scanf("%d", &num3);
sum = num1 + num2;
result = sum - num3;
printf("Total of Num1 and Num2 is: %d\n", sum);
printf("Subtract Num3 to the total: %d", result);
return 0;
}
***************************************************************************************
Activity7 no.2:Make a program that
will compute for the average grade of
student for the ff: subject: Math,
English, Science
Enter Name of Student: C ruz, Angelika
Enter Math Grade :85
Enter English Grade:85
Enter Science Grade:85
The average grade of student is:85
***************************************************************************************
#include <stdio.h>
int main() {
char name[20];
float math, english, science, average;
printf("Enter Name of Student: ");
scanf("%s", &name);
printf("Enter Math Grade: ");
scanf("%f", &math);
printf("Enter English Grade: ");
scanf("%f", &english);
printf("Enter Science Grade: ");
scanf("%f", &science);
average = (math + english + science) / 3;
printf("The average grade of %s is: %.2f", name, average);
return 0;
}
***************************************************************************************
Activity7 no.3: Make a program that
will compute for the salary of an
employee.
Enter Employee Name:crz,maria
Enter Rate per hour; 1 0 0 0
Enter No.of hours Work:5
Compute Salary:[sal-rph'nhw]50 0 0
***************************************************************************************
#include <stdio.h>
int main() {
char name[20];
float rateperhour, numberofhoursworked, salary;
printf("Enter Employee Name: ");
scanf("%s", &name);
printf("Enter Rate per Hour: ");
scanf("%f", &rateperhour);
printf("Enter Number of Hours Worked: ");
scanf("%f", &numberofhoursworked);
salary = rateperhour * numberofhoursworked;
printf("Salary of %s = %f", name, salary);
return 0;
}
***************************************************************************************