Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

determine the number of odd and even numbers and compute.

$
0
0
hi. my program has an error and i can't determine the wrong code of this.this program should accept specified number of integers , determine the number of odd and even numbers and compute the sum of even and odd numbers.
hope u can help me. THANKS


#include <iostream>
using namespace std;

int main () { 
    
    int  yourx,leta,letb,letc,letd,lete; 
    int noood,sumodd,noeven,sumeven;
    noood, sumodd, noeven, sumeven;
    
    cout<<"Enter No. of integers to enter:"<<endl; 
    cin>>yourx; 
    
    cout<<"Enter No. 1:";
    cin>>yourx;
    if (yourx+leta && yourx+letb && yourx+letc && yourx+letc) {
        noood+=1;
        noeven+=yourx;                
    }
    else {
        sumodd+=1;
        sumeven+=yourx;  
}
    
    cout<<"Enter No. 2:";
    cin>>yourx;
    if (yourx+leta && yourx+letb && yourx+letc && yourx+letc) {
        noood+=1;
        noeven+=yourx;                
    }
    else {
        sumodd+=1;
        sumeven+=yourx;  
}
    cout<<"Enter No. 3:";
    cin>>yourx;
    if (yourx+leta && yourx+letb && yourx+letc && yourx+letc) {
        noood+=1;
        noeven+=yourx;                
    }
    else {
        sumodd+=1;
        sumeven+=yourx;  
}
    cout<<"Enter No. 4:";
    cin>>yourx;
    if (yourx+leta && yourx+letb && yourx+letc && yourx+letc) {
        noood+=1;
        noeven+=yourx;                
    }
    else {
        sumodd+=1;
        sumeven+=yourx;  
}
    cout<<"Enter No. 5:";
    cin>>yourx;
    if (yourx+leta && yourx+letb && yourx+letc && yourx+letc) {
        noood+=1;
        noeven+=yourx;                
    }
    else {
        sumodd+=1;
        sumeven+=yourx;  
}
    
    cout<<"No.of odd:"<<noood<<endl;
    
    cout<<"Sum of odd"<<sumodd<<endl;
    
    cout<<"No. of even"<<noeven<<endl;;
    
    cout<<"Sum of even"<<sumeven<<endl;
    
    
    system ("pause");
    return 0;
    
}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>