Tuesday, June 1, 2010

Write a programe to swap two numbers

//Write a programe to swap two numbers//





#include<stdio.h>
#include<conio.h>
void main ()

{

int a,b,c;

clrscr ();

printf("Enter the two numbers\n");

printf("a=");

scanf("%d",&a);

printf("b=");

scanf("%d=",&b);

c=a;

a=b;

b=c;

printf("\na= %d",a);

printf("\nb= %d",b);

getch ();

}

Write a programe to check maximum number between three numbers

//Write a programe to check maximum number between three numbers//



#include<stdio.h>

#include<conio.h>
void main ()

{

int a,b,c;

clrscr ();

printf("Enter the three numbers to find the maximum between three numbers a,b and c");

scanf("%d%d%d",&a,&b,&c);

if(a>b && a>c)

{

printf("A is greater");

}

if(b>a && b>c)

{

printf("B is greater");

}

if(c>a && c>b)

printf("C is greater");



getch ();

}