Tuesday, November 24, 2020

C Program to display multiple variables.

#include <stdio.h>

int main()

{

 char ch = 'A';

 char str[20] = "Welcome to C";

 float flt = 10.234;

 int no = 150;

 double dbl = 20.123456;

 printf("Character is %c \n", ch);

 printf("String is %s \n" , str);

 printf("Float value is %f \n", flt);

 printf("Integer value is %d\n" , no);

 printf("Double value is %lf \n", dbl);

 printf("Octal value is %o \n", no);

 printf("Hexadecimal value is %x \n", no);

 return 0;

}

Output:

Character is A

String is Welcome to C

Float value is 10.234000

Integer value is 150

Double value is 20.123456

Octal value is 226

No comments:

Post a Comment