62 556
Assignments Done
98,8%
Successfully Done
In June 2018

Answer to Question #7771 in C++ for asim

Question #7771
write a program which take five integers from user and print the sum of all odd integers
Expert's answer
#include<iostream.h>

int main(int argc, char * argv[]){

int sum=0, num, i;
for (i=1;i<=5;i++){
& printf("Enter some integer please: ");
& scanf("%d", &num);
& if (num%2 != 0) sum += num;
}

printf("The sum of odd numbers is %d \n", sum);
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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions