==================
if(condition)
Statement1;
else
Statement2;
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
clrscr();
if(num>0)
printf(“\nNumber is positive”);
else
printf(“\nNumber is not positive.”);
getch();
}
clrscr();
if(num%2==0)
printf(“\nNumber is Even”);
else
printf(“\nNumber is Odd.”);
getch();
}
Formula used ,
y2-y1 = y3-y2
---------- ----------
x2-x1 x3-x2
#include<stdio.h>
#include<conio.h>
void main()
{
int x1,x2,y1,y2,x3,y3;
int d1,d2;
clrscr();
d1=(y2-y1)/(x2-x1);
d2=(y3-y2)/(x3-x2);
if(d1==d2)
printf(“\nLies in the same line”);
else
printf(“\nDoes not lies on the same line”);
getch();
}
num=121
rev=121
Number is palindrome
sum = 1^3+5^3+3^3=153
Number is armstrong
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
clrscr();
getch();
#include<stdio.h>
#include<conio.h>
void main()
{
int year;
clrscr();
printf(“\nEnter the year :”);
scanf(“%d”,&year);
if((year%4==0&&year%100!=0)||(year
%400==0))
printf(“\nLeap Year.”);
else
printf(“\nNot a Leap Year.”);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,max,smax;
clrscr();
if(a>b)
{
max=a;
smax=b;
}
else
{
max=b;
smax=a;
}
if(c>max)
{
smax=max;
max=c;
}
elseif(c>smax)
smax=c;
getch();
}