Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here's the assignment: Write a program that reads in five values, all integers, and prints the sum and the average (a real number) of these

Here's the assignment: Write a program that reads in five values, all integers, and prints the sum and the average (a real number) of these five numbers. Prompt the user for each number and make sure your print statements identify what the output actually is. Your prompt can be very simple, something like Enter a number and your print statements can be brief, as in the sum is xxx and the average is yyy

This is what I have so far :

#include int main (void){ int num_1; int num_2; int num_3; int num_4; int num_5; printf("Enter number 1: "); scanf("%d", & num_1); printf("Enter number 2: "); scanf("%d", & num_2); printf("Enter number 3: "); scanf("%d", & num_3); printf("Enter number 4: "); scanf("%d", & num_4); printf("Enter number 5: "); scanf("%d", & num_5); int Total; int (num_1 + num_2 + num_3 + num_4 + num_5)= Total; double Average = Total / 5; printf("Average: "); scanf("%d", & Average); return 0; }

I think there is a problem with the line in which i'm adding together the number variables. Any help is appreciated.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions