Search
 
SCRIPT & CODE EXAMPLE
 

CPP

even and odd sum in c++

#include<iostream>
using namespace std;

int main()
{
	do
	{
		int num, even = 0, odd = 0;

		for (int i = 0; i < 8; i++)
		{
			cin >> num;
			if (num % 2 == 0)
				even += num;
			else
				odd += num;
		}

		cout << "Even: " << even << endl;
		cout << "Odd: " << odd << endl;

	} while (true);
	

	return 0;
}
Comment

how to find even and odd numbers in c++

#include<bits/stdc++.h>
using namespace std;

int main ()

{
    int x;
    cin >> x;
    if (x % 2 == 0) {
        cout << x << " " <<"is even number" endl;
    } else {
        cout << x << " " << "is odd number" endl;
        }

    return 0;
}
Comment

even and odd in c++

#include <iostream>
using namespace std;

int main()
{
	int n;
	cout << "Enter an integer: ";
	cin >> n;
	(n % 2 == 0) ? cout << n << " Is Even." : cout << n << " Is Odd.";
}
Comment

even or odd program in c++

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int inp;
  cin>>inp;
  if(inp % 2 == 0)
  {
    cout<<" Even" <<endl;
  }
  else
  {
    cout<<"Odd"<<endl;
  }
}		
Comment

even odd c++

#include <iostream>
using namespace std;

int main()		{
	int x;
	cout << "Enter a number:";
	cin >> x;
		if (x%2==0)
		 	{
				cout <<x<<" is an EVEN number.";
			}
		else
			{
				cout <<x<<" is an ODD number.";
			}
	return 0;
				}
Comment

PREVIOUS NEXT
Code Example
Cpp :: string to integer in c++ 
Cpp :: c++ encapsulation 
Cpp :: cpp string slice 
Cpp :: c++ thread incide class 
Cpp :: c++ int to char* 
Cpp :: c++ logger class example 
Cpp :: remove specific element from vector c++ 
Cpp :: vector find 
Cpp :: how to declare a 2D vector in c++ of size m*n with value 0 
Cpp :: cpp vs c# 
Cpp :: number of digits in int c++ 
Cpp :: Palindrome String solution in c++ 
Cpp :: What is the "--" operator in C/C++? 
Cpp :: cpp float 
Cpp :: setw c++ 
Cpp :: notepad++ 
Cpp :: convert integer to string in c++ 
Cpp :: How to get cursor position c++ 
Cpp :: C++ Infinite while loop 
Cpp :: how to say hello world in c++ 
Cpp :: SUMOFPROD2 
Cpp :: c++ get whole line 
Cpp :: system("pause") note working c++ 
Cpp :: system cpp 
Cpp :: do while c++ 
Cpp :: CRED Coins codechef solution in c++ 
Cpp :: C++ fibo 
Cpp :: how to check if vector is ordered c++ 
Cpp :: c++ comment out multiple lines 
Cpp :: stoi in c++ 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =