Adding/subtract/multiply/divide three number with programming C


Adding three number:

/* we  going to make a program with programing  C . At first the program asked the user for the three number. After getting the number the program will show the addition of those three number.*/

#include <stdio.h>

int main()

{

int x,y,z,result;

printf(“Enter the 1st number: “);

scanf(“%d”,&x);

printf(“Enter the 2nd number: “);

scanf(“%d”,&y);

printf(“Enter the 3th number: “);

scanf(“%d”,&z);

result = x + y + z;

printf(“result=%d”,result);

retrun 0;

getch();

}

Subtract three number:

/* we  going to make a program with programing  C . At first the program asked the user for the three number. After getting the number the program will show the subtract of those three number.(1st number – 2nd number – 3th number = result)*/

#include <stdio.h>

int main()

{

int x,y,z,result;

printf(“Enter the 1st number: “);

scanf(“%d”,&x);

printf(“Enter the 2nd number: “);

scanf(“%d”,&y);

printf(“Enter the 3th number: “);

scanf(“%d”,&z);

result = x – y – z;

printf(“result=%d”,result);

retrun 0;

getch();

}


multiply three number:

/* we  going to make a program with programing  C . At first the program asked the user for the three number. After getting the number the program will show the multiply of those three number(1st number * 2nd number * 3th number = result).*/

#include <stdio.h>

int main()

{

int x,y,z,result;

printf(“Enter the 1st number: “);

scanf(“%d”,&x);

printf(“Enter the 2nd number: “);

scanf(“%d”,&y);

printf(“Enter the 3th number: “);

scanf(“%d”,&z);

result = x * y * z;

printf(“result=%d”,result);

retrun 0;

getch();

}

Divide three number:

/* we  going to make a program with programing  C . At first the program asked the user for the three number. After getting the number the program will show the multiply of those three number(1st number / 2nd number / 3th number = result).*/

#include <stdio.h>

int main()

{

int x,y,z,result;

printf(“Enter the 1st number: “);

scanf(“%d”,&x);

printf(“Enter the 2nd number: “);

scanf(“%d”,&y);

printf(“Enter the 3th number: “);

scanf(“%d”,&z);

result = (x / y)/ z;

printf(“result=%d”,result);

retrun 0;

getch();

}

we can also make a program which one can do addition, subtraction, multiplication, divide

/* we  going to make a program with programing  C . At first the program asked the user for the three number. After getting the number the program will show the addition, subtraction, multiplication, divide of those three number(1st number / 2nd number / 3th number = result).*/

#include <stdio.h>

int main()

{

int x,y, z, add, subtract, multiply;

float divide;

printf(“Enter the 1st number: “);                                           /*asked the user for enter 1st number*/

scanf(“%d”,&x);

printf(“Enter the 2nd number: “);                                         /*asked the user for enter 2nd number*/

scanf(“%d”,&y);

printf(“Enter the 3th number: “);                                         /*asked the user for enter 3th number*/

scanf(“%d”,&z);

add = x + y + z;

subtraction = x – y – z;

multiply = x*y*z;

divide = (x/y)/z;

printf(“addition=%d”,add);

printf(“subtraction=%d”,subtract);

printf(“multipication=%d”,multiply);

printf(“divination =%d”,divide);

retrun 0;

getch();

}

 

Advertisements

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s