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
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment