C Programs to practice - Biggest of three numbers


  This program is used to find the biggest number among three number. The program reads 3 numbers and check each number and find the biggest number.

Program: “Big3.c”

#include<stdio.h>

#include<conio.h>

void main()

{

 int a,b,c;

 printf("Enter the three numbers");

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

 if(a>b && a>c)

  printf("%d is the biggest number",a);

  else if(b>c)

   printf(" %d is the biggest number",b);

   else

   printf("%d is the biggest number",c);

   getch();

}

Output:

Enter the three numbers 2 3 5

5 is the biggest number


Try:

Write a c program to exchange two numbers.

How to do it???

Still thinking…

Here is the program

#include<stdio.h>

#include<conio.h>

void main()

{

 int x,y;

 printf("enter the numbers");

 scanf("%d %d",&x,&y);

 x=x+y;

 y=x-y;

 x=x-y;

 printf("The two numbers after exchange");

 printf("%d %d",x,y);

 getch();

 }

No comments:

Post a Comment