PropellerAds
Posted by : Unknown Wednesday 24 December 2014

//Arithmetic operation on three numbers
#include<stdio.h>;
#include<conio.h>;

//executing main program
void main()
{
//creating var for storing values
int i;
int j;
int k;

//take input from user
printf("Input three different integers \n");
scanf("%d %d %d", &i, &j, &k);

//calculating and displaying results of
//Adition
printf("\nThe sum is %d \n", i + j + k);
//average
printf("The average is %d \n", (i + j + k)/3);
//product
printf("The product is %d", i * j * k);

//smallest and largest no.
//first number
if (i < j & j<= k)
{
printf("\n \nThe smallest is %d", i);
} /*end if*/

if (j > i & j > k)
{
printf("\n \nThe largest is %d", i);
} /*end if*/

//2nd number
if (j < k & j <= i)
{
printf("\nThe smallest is %d", j);
} /*end if*/

if (j > k & j >= i)
{
printf("\nThe Largest is %d", j);
} /*end if*/

//3rd number
if (k < j & j<= i)
{
printf("\nThe smallest is %d", k);
} /*end if*/


if (k > j & j >= i)
{
printf("\nThe Largest is %d", k);
} /*end if*/

//chk and display even and odd no
//first no.
if ((i%2) == 0)
{
printf("\n \n%d is even", i);
}
else
{
printf("\n \n%d is odd", i);
}

//2nd no.
if (j%2 == 0)
{
printf("\n \n%d is even", j);
}
else
{
printf("\n \n%d is odd", j);
}

//3rd no.
if (k%2 == 0)
{
printf("\n \n%d is even", k);
}
else
{
printf("\n \n%d is odd", k);
}

//for disabling automatic close off of program after execution of program
_getch();
}//end

Leave a Reply

Subscribe to Posts | Subscribe to Comments

PropellerAds
PropellerAds

Popular Post

Powered by Blogger.

- Copyright © BSCS -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -