Write a program to read the values of X and Y and print the results of the following expressions in one lne:

#include<stdio.h>

int main()
{
float x,y,a,b,c;
printf(“Enter the value of x & y: “);
scanf(“%f%f”,&x,&y);
if(x-y==0)
printf(“(a)=imagine”);
a=(x+y)/(x-y);
b=(x+y)/2;
c=(x+y)*(x-y);
printf(“(a)=%.1f(b)=%.1f(c)=%.1f”,a,b,c);
return 0;
}

Given the string “WORDPROCESSING”,write a program to read the string from the terminal and display the same in the following formats:

#include<stdio.h>

int main()
{
char a[2],b[11];
printf(“Enter the string:”);
scanf(“%4s%10s”,a,b);
printf(“(a) %s %s\n”,a,b);
printf(“(b) %s\n %s\n”,a,b);
printf(“(c) %.1s.%.1s.”,a,b);
return 0;
}

Create your own website, free on WordPress.com.Create your own website.
Start free