Answer to Question #47755 in C++ for arundhati

Question #47755
C++ program to print the sum of odd numbers in an array
1
Expert's answer
2014-10-13T04:16:42-0400
#include <iostream>
using namespace std;
//main method
int main()
{
//total number to input
int totalNumber=0;
//array of numbers
int numbers[100];
//promt user to enter "How many numbers do you want to enter"
cout<<"How many numbers do you want to enter?: ";
//read total Number
cin>>totalNumber;
for(int i=0;i<totalNumber;i++){
cout<<"Enter value: ";
cin>>numbers[i];
}
//check if velues in array is prime or not
for(int i=0;i<totalNumber;i++){
if(numbers[i]%2==1){
cout<<numbers[i]<<" is odd number.\n";
}
}
//delay
system("pause");
//exit program
return 0;
}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS