Research Paper - Nolan
Research Paper - Nolan
1. if
2. if else
3. nested if else
4. switch
5. condi onal operator (?::)
6. loop
i) while
ii) for
iii) do while
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a, b;
if(a>b)
cout<<"a is greater than b";
if(b>a)
cout<<"b is greater than a";
if(a==b)
cout<<"a and b both are equal";
getch();
*/
/*
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a, b, c, d;
int min = a;
if(b<min)
min = b;
if(c<min)
min = c;
if(d<min)
min = d;
cout<<"Smallest = "<<min;
getch();
}
*/
/* // even or odd
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int num;
if(num % 2 == 0)
cout<<"its even number";
else
cout<<"its odd number";
getch();
*/
/*
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int year;
getch();
}
*/
/*
// posi ve, nega ve or zero
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int num;
if(num > 0)
cout<<"Its posi ve";
else if(num < 0)
cout<<"Its nega ve";
else
cout<<"its zero";
getch();
}
*/
/*
// largest of 3 int numbers
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a, b, c;
if(a>b)
if(a>c)
cout<<"a is the largest";
else
cout<<"c is the largest";
else if(b>c)
cout<<"b is the largest";
else
cout<<"c is the largest";
getch();
*/
/*
// roots of quad. equa on
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
if(a == 0) //if1
{
cout<<"Its linear equa on"<<endl;
x1 = -c/b;
cout<<"Value of X = "<<x1<<endl;
}
else{ // else if 1
d = b*b - 4*a*c;
else
{
cout<<"Roots are real and
different"<<endl;
x1 = (-b + sqrt(d)) / (2 * a) ;
x2 = (-b - sqrt(d)) / (2 * a);
getch();
}
*/