Friday, 21 December 2018

C PROGRAM USING DATA TYPES

// C PROGRAM USING DATA TYPES

#include <stdio.h>
int main()
{
    int a = 1003;
    char b ='S';
    float c = 3.14;
    double d = 36.555555;
      
    printf("Hello World! Welcome to C Programming \n");
    printf("************************************* \n");
    //printing the variables defined above along with their sizes
    printf("Hello! I am a character. My value is %c and "
           "my size is %lu byte.\n", b,sizeof(char));
    //can use sizeof(b) above as well
 
    printf("Hello! I am an integer. My value is %d and "
           "my size is %lu  bytes.\n", a,sizeof(int));
    //can use sizeof(a) above as well
 
    printf("Hello! I am a floating point variable."
           " My value is %lf and my size is %lu bytes.\n",c,sizeof(float));

    printf("Hello! I am a double floating point variable."
           " My value is %lf and my size is %lu bytes.\n",d,sizeof(double));
    //can use sizeof(c) above as well
    printf("************************************* \n");
    printf("Bye! See you soon. :)\n");
 
    return 0;
}

OUTPUT:-