/* WAP to print sum and largest value in a single dimension array*/
//Header files
#include<iostream.h>
#include<conio.h>
//Main function
void main()
{
//Array declaration[single dimension]
int num[5],i,sum,large;
sum=0,large=0;
clrscr();
//Taking input from the user
for(i=0;i<5;i++)
{
cout<<"Enter a number:";
cin>>num[i];
}
//Diaplaying output to the user
for(i=0;i<5;i++)
{
cout<<"number["<<i<<"]:"<<num[i]<<"\t";
sum=sum+num[i];
if(num[i]>large)
{
large=num[i];
}
}
cout<<"Sum of the number entered:"<<sum<<endl;
cout<<"Largest of the number entered:"<<large;
// Function for clearing screen
getch();
}