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
#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);
}
Comments
Leave a comment