Answer to Question #116166 in C for Meena A

Question #116166
Rita has newly enrolled into the computer science course in Softech Solutions to learn c Programming , to know about data types she has given a task to solve the following expression with respective data type as ‘a’ and ‘b’ as integer ,’c’ as character , ‘ax’ as long integer, ‘s’ as short integer, ‘dx’ is double and ‘ux’ as unsigned long integer , the expression to get solved is

i)((int) dx) + ax ii) ax + b iii)ax + ux iv) s + c

Help rita to solve the task by writing the c program
1
Expert's answer
2020-05-16T13:46:40-0400
#include<stdio.h>


void main(){
	int a, b;
	char c;
	long int ax;
	short int s;
	double dx;
	unsigned long int ux;


	printf("Enter two integer value of a and b: ");
	scanf("%d %d", &a, &b);


	printf("Enter one character value of c: ");
	scanf(" %c",&c);


	printf("Enter one long integer value of ax: ");
	scanf("%ld",&ax);


	printf("Enter one sort integer value of s: ");
	scanf("%hi",&s);


	printf("Enter one double value of dx: ");
	scanf("%lf",&dx);


	printf("Enter one unsigned long integer value of ux: ");
	scanf("%lu",&ux);


	// i)((int) dx) + ax 
	printf("Value of 1st expression ((int) dx) + ax  is %d.\n",((int) dx) + ax);
	//ii) ax + b 
	printf("Value of 2nd expression ax + b  is %d. \n",(ax + b));	
	//iii)ax + ux 
	printf("Value of 3rd expression ax + ux  is %d \n",(ax + ux));	
	//iv) s + c	
	//int i = (int)c;
	printf("Value of 4th expression s + c  is %d. \n",(s+c));


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS