Assignment4V2.c - #include<stdio.h> int main int num1 = 10,num2 = 10,num3 = 10,num4 double average while(num1 > 9 printf"Enter first number here

# Assignment4V2.c - #include<stdio.h> int main int num1 =...

• Homework Help
• 2

This preview shows page 1 - 2 out of 2 pages.

#include<stdio.h> int main() { int num1 = 10,num2 = 10,num3 = 10,num4 = 10,sum,product,largest,smallest; double average; while (num1 > 9) { printf("Enter first number here: "); scanf("%d",&num1); if (num1 > 9) printf("Invalid integer please enter 0 - 9 only \n"); } while (num2 > 9) { printf("Enter second number here: "); scanf("%d",&num2); if (num2 > 9) printf("Invalid integer please enter 0 - 9 only \n"); } while (num3 > 9) { printf("Enter third number here: "); scanf("%d",&num3); if (num3 > 9) printf("Invalid integer please enter 0 - 9 only \n"); } while (num4 > 9) { printf("Enter fourth number here: "); scanf("%d",&num4); if (num4 > 9) printf("Invalid integer please enter 0 - 9 only \n"); } sum = num1 + num2 + num3 + num4; average =(double)sum / 4; product = num1 * num2 * num3 * num4; { if(num1>=num2 && num1>=num3 && num1>=num4) { largest = num1; } else if(num2>=num1 && num2>=num3 && num2>=num4)

Subscribe to view the full document.

Unformatted text preview: { largest = num2; } else if(num3&gt;=num2 &amp;&amp; num3&gt;=num1 &amp;&amp; num3&gt;=num4) { largest = num3; } else { largest = num4; } } { if(num1&lt;=num2 &amp;&amp; num1&lt;=num3 &amp;&amp; num1&lt;=num4) { smallest = num1; } else if(num2&lt;=num1 &amp;&amp; num2&lt;=num3 &amp;&amp; num2&lt;=num4) { smallest = num2; } else if(num3&lt;=num2 &amp;&amp; num3&lt;=num1 &amp;&amp; num3&lt;=num4) { smallest = num3; } else { smallest = num4; } } printf(&quot;The sum of these four number %d,%d,%d,%d is %d \n&quot;,num1,num2,num3,num4,sum); printf(&quot;The average of these four number %d,%d,%d,%d is %.2f \n&quot;,num1,num2,num3,num4,average); printf(&quot;The product of these four number %d,%d,%d,%d is %d \n&quot;,num1,num2,num3,num4,product); printf(&quot;The largest among these four number %d,%d,%d,%d is %d \n&quot;,num1,num2,num3,num4,largest); printf(&quot;The smallest among these four number %d,%d,%d,%d is %d \n&quot;,num1,num2,num3,num4,smallest); return 0; }...
View Full Document

• Fall '18

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes