To perfrom input and output of all basic data types

#include<stdio.h>
int main() {
    char c;
    unsigned char uc;
    short s;
    unsigned short us;
    int i;
    unsigned int ui;
    long l;
    unsigned long ul;
    long long ll;
    unsigned long long ull;
    float f;
    double d;
    long double ld;
    scanf("%c",&c);
    scanf(" %c",&uc);
    scanf("%hi", &s);
    scanf("%hu", &us);
    scanf("%d", &i);
    scanf("%lu", &ui);
    scanf("%ld", &l);
    scanf("%lu", &ul); 
    scanf("%lld", &ll);
    scanf("%llu", &ull);
    scanf("%f", &f);
    scanf("%lf", &d);
    scanf("%Lf", &ld);
    printf("\ncharacter: '%c' \n", c);
    printf("unsigned character: '%c' \n\n", uc);
   printf(" signed short: %hi \n", s);
    printf(" unsigned short: %hu \n\n", us);
    printf(" signed int: %d \n", i);
    printf(" unsigned int: %lu \n\n", ui);
    printf(" signed long: %ld \n", l);
    printf("unsigned long: %lu \n\n", ul);
    printf("signed long long: %lld \n", ll);
    printf("d unsigned long long: %llu \n\n", ull);
    printf(" float: %f \n", f);
    printf(" double: %lf \n", d);
    printf(" long double: %Lf \n", ld);

    return 0;
}

Input:
n
t
-30000
65535
-2145654
4102356
-5624444
85555566666
-5555348956412
895461245687922
2.356
23.5656
22.666999
output:

character: 'n'
unsigned character: 't'

 signed short: -30000
 unsigned short: 65535

 signed int: -2145654
 unsigned int: 4102356

 signed long: -5624444
unsigned long: 85555566666

signed long long: -5555348956412
d unsigned long long: 895461245687922

 float: 2.356000
 double: 23.565600

 long double: 22.666999



No comments:

Post a Comment