Computer Science, asked by arshdeepkaur75, 4 months ago

write program of z=x>y?x:y in computer​

Answers

Answered by omjhariya2807
0

Problem Statement : Write a program to read the values of x, y and z and print the results of the following expressions in one line.

(x+y+z) / (x-y-z)

(x+y+z) / 3

(x+y) * (x-y) * (y-z)

#include<stdio.h>

#include<conio.h>

void main() {

int x, y, z;

float a, b, c;

clrscr();

printf("\nEnter the values of x,y and z : ");

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

a = (x + y + z) / (x - y - z);

b = (x + y + z) / 3;

c = (x + y) * (x - y) * (y - z);

printf("\nValue of a = %f",a);

printf("\nValue of b = %f",b);

printf("\nValue of c = %f",c);

getch();

}

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

#include<stdio.h>

#include<conio.h>

void main() {

int x, y, z;

float a, b, c;

clrscr();

printf("\nEnter the values of x,y and z : ");

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

a = (x + y + z) / (x - y - z);

b = (x + y + z) / 3;

c = (x + y) * (x - y) * (y - z);

printf("\nValue of a = %f",a);

printf("\nValue of b = %f",b);

printf("\nValue of c = %f",c);

getch();

}

Output:

Enter the values of x,y and z : 1.1 2.5 5.5

Value of a = -1.000000

Value of b = 2010.000000

Value of c = 27939.000000

1

2

3

4

Enter the values of x,y and z : 1.1 2.5 5.5

Value of a = -1.000000

Value of b = 2010.000000

Value of c = 27939.000000

Similar questions