Create a program that outputs the average of three input numbers. Let the values of the three input numbers be, 10, 20 and 45.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Create a program that outputs the average of three input numbers. Let the values of the three input numbers be, 10, 20 and 45. The expected screen output is,

Please help how to fix this issue? 

Codio
Project
File
Edit
Find
View
Tools
Education
Help
A Compile & Run
> Project Index (static)
O Debug Current File
KSOLIVEN
task2.c
3. Task 2: Getting..
#include<stdio.h>
2
Collapse
!!
3
int main()
4
5 -
{
3. Task 2: Getting the average of three numbers
int numl=10, num2=20, num3=45;
int sum, avg;
7
The value 10, 20 and 45 are input values during running time execution
printf("Numbers 1 = %d\n", num1);
printf("Numbers 2 = %d\n", num2);
printf("Numbers 3 = %d \n",num3);
8
9
10
11
12
sum = numl + num2 + num3;
OUTPUT
avg = sum / 3;
printf("Average is = %d\n",avg );
13
14
number 1 = 10
15
16
return 0;
17
}
number 2 = 20
18
19
number 3 = 45
20
21
22
Average is = 25
23
24
25
Check your program by clicking the buttons below...
0% (1:0)
Transcribed Image Text:Codio Project File Edit Find View Tools Education Help A Compile & Run > Project Index (static) O Debug Current File KSOLIVEN task2.c 3. Task 2: Getting.. #include<stdio.h> 2 Collapse !! 3 int main() 4 5 - { 3. Task 2: Getting the average of three numbers int numl=10, num2=20, num3=45; int sum, avg; 7 The value 10, 20 and 45 are input values during running time execution printf("Numbers 1 = %d\n", num1); printf("Numbers 2 = %d\n", num2); printf("Numbers 3 = %d \n",num3); 8 9 10 11 12 sum = numl + num2 + num3; OUTPUT avg = sum / 3; printf("Average is = %d\n",avg ); 13 14 number 1 = 10 15 16 return 0; 17 } number 2 = 20 18 19 number 3 = 45 20 21 22 Average is = 25 23 24 25 Check your program by clicking the buttons below... 0% (1:0)
Codio
Project
File
Edit
Find
View
Tools
Education
Help
A Compile & Run
• Project Index (static)
O Debug Current File
KSOLIVEN
task2.c
3. Task 2: Getting...
1 -
#include<stdio.h>
2
Collapse
!!
3
int main()
4
5 -
{
3. Task 2: Getting the average of three numbers
int numl=10, num2=20, num3=45;
int sum, avg;
Check 1 failed
7
Output:
printf("Numbers 1 = %d\n", num1);
printf("Numbers 2 = %d\n", num2);
printf("Numbers 3 = %d \n",num3);
8
Numbers 1 = 10
9
10
Numbers 2 = 20
11
Numbers 3 = 45
12
sum = num1 + num2 + num3;
Average is = 25
avg = sum / 3;
printf("Average is = %d\n",avg );
13
14
Expected:
15
number 1 =
16
return 0;
number 2 =
17
}
number 3 =
18
19
Average is = 25
20
Feedback:
21
The value 10, 20 and 45 are input
22
23
numbers. You may also check the
24
formula and consider the
25
precedence of operator.
0% (1:0)
Transcribed Image Text:Codio Project File Edit Find View Tools Education Help A Compile & Run • Project Index (static) O Debug Current File KSOLIVEN task2.c 3. Task 2: Getting... 1 - #include<stdio.h> 2 Collapse !! 3 int main() 4 5 - { 3. Task 2: Getting the average of three numbers int numl=10, num2=20, num3=45; int sum, avg; Check 1 failed 7 Output: printf("Numbers 1 = %d\n", num1); printf("Numbers 2 = %d\n", num2); printf("Numbers 3 = %d \n",num3); 8 Numbers 1 = 10 9 10 Numbers 2 = 20 11 Numbers 3 = 45 12 sum = num1 + num2 + num3; Average is = 25 avg = sum / 3; printf("Average is = %d\n",avg ); 13 14 Expected: 15 number 1 = 16 return 0; number 2 = 17 } number 3 = 18 19 Average is = 25 20 Feedback: 21 The value 10, 20 and 45 are input 22 23 numbers. You may also check the 24 formula and consider the 25 precedence of operator. 0% (1:0)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education