Tuesday 24 February 2015

Conditional Statements in C++

#include<iostream.h>
#include<conio.h>
main()
{
int a;
clrscr();
cout<<"\n Enter Number :";
cin>>a;

if(a>0)
{
cout<<"\n Given Number is Positive";
}
if(a<0)
{
cout<<"\n Given Number is Negative";
}
getch();
}

=====================

#include<iostream.h>
#include<conio.h>
main()
{
int a;
clrscr();
cout<<"\n Enter Number :";
cin>>a;

if(a>0)
{
cout<<"\n Given Number is Positive";
}
else
{
cout<<"\n Given Number is Negative";
}
getch();
}


No comments:

Post a Comment