Results 1 to 8 of 8

Thread: Find odd and even number in c++

  1. #1
    zeeshanaayan is offline Senior Member+
    Last Online
    2nd May 2013 @ 11:28 AM
    Join Date
    01 Feb 2013
    Location
    Karachi
    Gender
    Male
    Posts
    223
    Threads
    3
    Credits
    0
    Thanked
    5

    Default Find odd and even number in c++

    #include<iostream>
    using namespace std;
    void main()
    {
    int cont,a;
    cout<<"Enter a number\t";
    cin>>a;
    if (a%2==0 &&a>0)
    cout<<"Even\n";
    else
    cout<<"Odd\n";
    }


    Learn C++ Tutorial.
    مطالعہ سب کے لئے

  2. #2
    malik2malik is offline Junior Member
    Last Online
    29th November 2013 @ 10:54 AM
    Join Date
    29 Mar 2013
    Location
    Lahore
    Age
    31
    Gender
    Male
    Posts
    25
    Threads
    3
    Credits
    930
    Thanked: 1

    Default

    Very GOOD

  3. #3
    kamranIlyas is offline Senior Member+
    Last Online
    28th November 2021 @ 12:11 PM
    Join Date
    28 Feb 2009
    Posts
    203
    Threads
    6
    Credits
    544
    Thanked
    12

    Default

    very nice .... Prime numbers ka lya kia programme ho ga

  4. #4
    Logicview's Avatar
    Logicview is offline Senior Member+
    Last Online
    10th May 2020 @ 10:46 PM
    Join Date
    05 Apr 2013
    Location
    Gojra
    Age
    33
    Gender
    Male
    Posts
    180
    Threads
    14
    Credits
    5
    Thanked
    14

    Default

    great work

  5. #5
    zeeshanaayan is offline Senior Member+
    Last Online
    2nd May 2013 @ 11:28 AM
    Join Date
    01 Feb 2013
    Location
    Karachi
    Gender
    Male
    Posts
    223
    Threads
    3
    Credits
    0
    Thanked
    5

    Default

    Thank you buddy
    Without ITD thread/post link, No other link allowed in Sig... ITD Team

  6. #6
    irfanshah4 is offline Senior Member+
    Last Online
    5th May 2013 @ 05:20 PM
    Join Date
    01 May 2013
    Gender
    Male
    Posts
    32
    Threads
    1
    Credits
    0
    Thanked
    0

    Default

    great

  7. #7
    shery_97 is offline Junior Member
    Last Online
    28th October 2013 @ 06:53 PM
    Join Date
    25 Oct 2013
    Age
    25
    Gender
    Male
    Posts
    3
    Threads
    0
    Credits
    680
    Thanked
    0

    Default

    #include <iostream.h>
    #include <conio.h>
    #include <math.h>
    #include <stdlib.h>
    main()

    {

    int num1,num2,num3,result;
    char choice;
    do
    {
    cout <<"Please selecct a number to perform the funtion"<<"\n";
    cout<<"1:Addition\n";
    cout<<"2:Subtraction\n";
    cout<<"3ivison\n";
    cout<<"4:Multiplication\n";
    cout<<"5:Squareroot\n";
    cout<<"6:Help\n";
    cout<<"7:About\n";
    cin>>choice;
    }
    while(choice<'1' || choice>'7' || choice='q')
    switch (choice)
    {
    if (choice==q)
    break;
    case '1';
    cout<<"Please enter a num:\n";
    cin>>num1;
    cout<<"Please enter another number to be added:\n";
    cin>>num2;
    result=num1+num2;
    cout<<"Your answer is:"<<result<<endl;
    break;
    case '2';
    cout<<"Please enter a num:\n";
    cin<<num1;
    cout<<"Please enter another num to be Subtracted:\n";
    cin>>num2;
    result=num1-num2;
    cout<<"Your answer is:"<<result<<endl;
    break;
    case '3';
    cout<<"Please enter a num:\n";
    cin>>num1;
    cout<<"Please enter another num to be divided:\n";
    cin>>num2;
    result=num1/num2;
    cout<<"Your answer is:"<<result<<endl;
    break;
    case '4';
    cout<<"Please enter a num:\n";
    cin>>num1;
    cout<<"Please enter another number to be multiplied:\n";
    cin>>num2;
    result=num1*num2;
    cout<<"Your answer is:"<<result<<endl;
    break;
    case '5';
    cout<<"Please enter a num:\n"
    cin>>num1;
    result=sqrt(num1);
    cout<<"Your answer is:"<<result<<endl;
    break;
    case '6';
    cout<<"Please select an option to perform the funtion"<<end;<<"e.g Press 1 for Addition e.t.c\n"
    break;
    case '7';
    cout<<"This is a simple calculator made by Sheharyar Ahmad.you can add,subtract,divide two numbers\n";
    break;
    default;
    cout<<"It is not an option\n"
    getch();
    }
    }


    \\ye program dev++ mai compile nai ho raha .is program mai errors aa rai hain plz help;
    cin

  8. #8
    chudhrytalha is offline Senior Member+
    Last Online
    7th December 2013 @ 01:55 PM
    Join Date
    01 Sep 2013
    Location
    bahawalpur
    Age
    28
    Gender
    Male
    Posts
    32
    Threads
    3
    Credits
    1,015
    Thanked
    0

    Default

    nice

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •