Write a c++ program to accept 5 number usin while and print their sum then print the fifth number and second number and print if second is less or bigger of equal to fifth.
1
Expert's answer
2011-01-13T15:01:39-0500
#include <iostream> using namespace std;
int main() { int i=0,sum=0; int a[5]; cout<<"Enter five numbers\n"; while(i!=5) { & cin>>a[i]; & sum=sum+a[i]; & i++; } cout<<"\nSum equals& "<<sum<<endl; cout<<"Fifth number equqls quot;<<a[4]<<endl; cout<<"Second number equals& quot;<<a[1]<<endl; if(a[1]<a[4]) cout<<"Second number is less then fifth\n"; if(a[1]>a[4]) cout<<"Second number is bigger then fifth\n"; if(a[1]==a[4]) cout<<"Second number is equal fifth\n"; system("pause"); return 0; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
I was amazed on the turnaround on not only the work but the response time. There were 4-5 assignments before that began to make me wonder on the customer service aspect and not just the completion of work. This assignment and support brought light at the end of the tunnel.
Comments
Leave a comment