Write a C program to read the values of x and y and print the results of the following expressions in one line:
i. (x + y) / (x - y)
ii. (x + y)(x - y)

Program Code:
i. (x + y) / (x - y)
#include<stdio.h>
void main()
{
int x,y,A,B;
float Result;
printf("Enter the values of x,y\n");
scanf("%d %d " ,&x, &y);
A=(x+y);
B=(x-y);
Result=A/B ;
printf("%f", Result);
}

ii. (x + y)(x - y)
#include<stdio.h>
void main()
{
int x,y,A,B;
float Result;
printf("Enter the values of x,y\n");
scanf("%d %d " ,&x, &y);
A=(x+y);
B=(x-y);
Result=A*B ;
printf("%f", Result);
}

Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: