Header Ads Widget

Ticker

6/recent/ticker-posts

Find Even And Odd Using For Loop C++ Program - Digitalise Data

 

"Digitalise Data", "Even Odd Profram c++"

This Program Is Helps Pront Even And Odd Using For Loop In C++ Language


      For Printing:- "Even Number"
_____________________________________________________
#include <iostream.h>
#include <conio.h>

int main()
{
    int i,num;
    cout<<"Print all even numbers until\n";
    cin>>num;
    cout<<"Even numbers from 1 to"<<num<< are\n";

    for(i=1; i<=num; i++)
    
        if(i%2==0)
        {
            cout<<i<<"\n";
        }
    }
getch();
    return 0;
}


           For Printing-"Odd Number"
_____________________________________________________

#include <iostream>
#include <conio.h>
using namespace std;

int main()
{
    int i,num;
    cout<<"Print all odd numbers until\n";
    cin>>num;    
    cout<<"Odd numbers from 1 to"<<num<< are\n";

    for(i=1; i<=num; i++)
        if(i%2==1)
        {
            cout<<i<<"\n";
        }
    }
getch();
    return 0;

_____________________________________________________

Run This Program Using Turbo C++ in Pc Or TurboCdroid in Android It Will Work


#DigitaliseData
#C++Programing

Post a Comment

0 Comments