AssignmentAV.c - *Programmer Reymark Rabanillo Instructor Aldrin Obsanga*Class BSIT 1-1*Write a program that inputs four different integers from the

# AssignmentAV.c - *Programmer Reymark Rabanillo Instructor...

• Homework Help
• 1

This preview shows page 1 out of 1 page.

/* *Programmer : Reymark Rabanillo Instructor : Aldrin Obsanga *Class : BSIT 1-1 * *Write a program that inputs four different integers from the keyboard , *then print the sum,the average,the product,the smallest and the largest of these numbers. */ #include<stdio.h> main(void) { int num[4],product = 1,sum = 0,array,largest = 0,smallest = 2000000000; double average; printf(" ***Please enter four different integers*** \n\n"); printf("* Enter first integer here : "); scanf("%d",&num[0]); printf("* Enter second integer here : "); scanf("%d",&num[1]); printf("* Enter third integer here : "); scanf("%d",&num[2]); printf("* Enter fourth integer here : "); scanf("%d",&num[3]); for (array = 0 ; array < 4; array++) { sum = sum + num[array]; product = product * num[array]; if (largest < num[array]) largest = num[array]; if (smallest > num[array]) smallest = num[array];

Unformatted text preview: if (array == 3) average = (double) sum / 4; } printf(&quot;************************************************************************ *&quot;); printf(&quot;\n* *&quot;); printf(&quot; \n* The sum of these four number \&quot;%d,%d,%d,%d\&quot; is : %d \n&quot;,num[0],num[1],num[2],num[3],sum); printf(&quot;* The average of these four number \&quot;%d,%d,%d,%d\&quot; is : %.2f \n&quot;,num[0],num[1],num[2],num[3],average); printf(&quot;* The product of these four number \&quot;%d,%d,%d,%d\&quot; is : %d \n&quot;,num[0],num[1],num[2],num[3],product); printf(&quot;* The smallest among these four number \&quot;%d,%d,%d,%d\&quot; is : %d \n&quot;,num[0],num[1],num[2],num[3],smallest); printf(&quot;* The largest among these four number \&quot;%d,%d,%d,%d\&quot; is : %d \n&quot;,num[0],num[1],num[2],num[3],largest); printf(&quot;* *\n&quot;); printf(&quot;************************************************************************ *&quot;); 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