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 ();

}

Saturday, May 22, 2010

Write a Programe to Add two Digits

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

{
int a,b,c;
clrscr ();
printf("Enter the number "); //For eg. 2+2//
scanf("%d%d",&a,&b);
c=a+b;
printf("Answere is %d",c); //Answer is 4 //
getch ();
}