Help resolve the question in C ++ (Calculator)

hey
may I have some help to get solve for my problem, that you can find it in the web down?

http://cdn.top4top.net/i_49766a2a9f1.jpg

Please
Last edited on
Wow! You're going to have to show a little more effort than posting a link to a picture of your homework assignment. Post your attempt at a solution and ask specific questions about where you're stuck. No one is going to do your work for you.
Where is error in the program?
Less number of shows me the number 0 and the correct answer is No. 1
Help me solve this step....

(note:I speak a little English)


#include <iostream>
#include <conio.h>
using namespace std;

void main() 
{
   int size=7;                                 //Array size 
   int array2[7]={1, 2, 3, 4, 5 , 6, 7};      //Declaring array
   int i,multiply=1,avg;                

  	for(int i=0;i<=6;i++)
	 {
    multiply*=array2[i];
	avg=multiply / size;
	 } 

	int min=0;
	for (int i=1; i<6; i++)
    {
        if(array2[i]<min)
           min=array2[i];
        }

	int *last=array2;
	   

	cout<<"Multiplication is = "<<multiply<<endl;
	cout<<"Average is = "<<avg<<endl;
	cout<<"Minimum is = "<<min<<endl;
	cout<<"First element is = "<<*last<<endl;
	last++;
	
	getch ();

}
Output

http://cdn.top4top.net/i_29b1af867d1.jpg

Minimum is not true!!!
The reason minimum is printing zero is because you initialize it to zero. Since zero is less than any value in the array, min remains zero. Initialize zero to the first value instead:
int min = array2[0];
The average value is normally the sum of the values divided by the size, not the product.
it is working

thank you dhayden
Topic archived. No new replies allowed.