Answer to Question #256040 in C for deee

Question #256040

write a program which loads(from the keyboard)variables of four basic types

1.integer number(preferably short)

2.floating point number(preferably double)

3.single character(char)

4.text(using array text representation char text[30])

5.boolean(logical TRUE/FALSE)(int?)

and the display the collected values in five following rows in a formated form:

on 15 positions

aligned /justified to right

with maximally 2 fraction digits


1
Expert's answer
2021-10-24T18:32:17-0400
#include<stdio.h>
int main(){
	short int n;
	printf("Enter a number: ");
	scanf("%d", &n);
	printf("%d", n);
	float number;
	printf("\nEnter a number: ");
	scanf("%f", &number);
	char h;
	printf("\nEnter a character: ");
	scanf("%c", &h);
	printf("The character is:  ", h);
	char text[30];
	printf("\nEnter a text: ");
	scanf("%s", &text);
	printf("\nThe text is: %s", text);
}

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