Facebook Twitter Google RSS

Friday, 11 December 2015

Find Odd or Even Using Conditional Operator in C and C++

Tapan     20:27  2 comments

// WE USE THIS CODE IN C // 
  
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a;

printf("Enter Any no.");
scanf("%d",&a);

(a%2==0)?printf("Even No."):printf("Odd No.");

getch();
}

  
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a;

cout<<"Enter Any no.";
cin>>a;

(a%2==0)?cout<<"Even No.":cout<<"Odd No.";

getch();
}

Find Odd or Even Using Conditional Operator in C and C++

, , , , , , ,

Related Posts

2 comments :

  1. how to retrieve data from database

    ReplyDelete
  2. hi.. Nikknews

    this code will help you to solve your problem

    connect_error) {
    die("Connection failed: " . $conn->connect_error);
    }

    $sql = "SELECT id, firstname, lastname FROM MyGuests";
    $result = $conn->query($sql);

    if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
    echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "
    ";
    }
    } else {
    echo "0 results";
    }
    $conn->close();
    ?>

    ReplyDelete

Popular Post

Website Worth
© 2014 BCA Developer. Powered by E Friends.
Contact

Contact Us

Name

Email *

Message *