Showing posts with label Turbo C Max Number. Show all posts
Showing posts with label Turbo C Max Number. Show all posts

Thursday, December 25, 2008

A Program that will Find the Two Numbers Addition

First Method:

#include
Void main ()
{
int a, b, sum;
sum = a + b
printf ("Enter Two Numbers :\n");
scanf ("%d %d\n", & a, & b);
printf ("Sum of two Numbers: \n", sum);
}

Second Method:

#include
int main ()
{
int a, b, sum;
sum = a + b
printf ("Enter First Input:\n");
scanf ("%d\n", & a);
printf ("Enter Second Input:\n");
scanf ("%d\n", & b);
printf ("Sum is: \n", sum);
}

A Program that will Count Temperature From Celcius to Farenite

#include
void main ()
{
float cel, faren;
printf ("Enter value in celcius:\n");
scanf ("%f\n", &cel);
faren = 18*cel+32;
printf ("Farenite Result is :\n", faren);
}

A Program that will Find the Max Number among Two Numbers

#include
void main ()
{
int a, b, max;
printf ("Enter Two Number:\n");
scanf ("%d %d\n", &a, &b);
if (a>b)
{
max = a;
}
else
{
max = b;
}
printf ("Max of %d and %d is %d \n", a, b, max);
}

Wednesday, December 3, 2008

A Program that will Count Leap Year

#include
void main ()
{
int year,
printf ("Enter the year: ");
scanf ("%d", & year);
if (year % 4 = = 0 & & year % 100! = 0 || year % 400 = = 0)
{
printf ("It is a leap year\n");
}
else
{
printf ("It is not a leap Year\n");
}
}

A Program that will Find the Max Number among three Number

#include
void main ()
{
int a,b,c,max,
printf ("Enter Three Values: ");
scanf ("%d %d %d", &a, &b, &c);
if (a>b)
{
if (a>=c)
max = a,
else
max = c,
}
else
{
if (b>=c)
max = b,
else
max = c,
}
printf ("Maximum of %d, %d and %d is %d\n", a,b,c,max);
}