C printf function

  • C printf function is predefined function. By using this function, we can print data on console.
  • While working with printf(), it can take any number of arguments but first argument must be within the double quotes(“”) and every argument should separated with comma(,).
  • The scientific name of the monitor is called.
  • Within the double quotes, whatever we pass it prints same, if any format specifiers are there, then that copy the type of value.

Format specifiers:
Format specifiers will indicate that, what kind of data need to be printed of console.

int –> %d
float –> %f
char –> %c

Examples:

printf(“Welcome to k2schools”);
printf(“Welcome to K2SCHOOLS”);
printf(“%d Welcome % d”,10,20);
printf(“3+5=%d”,3+5);
printf(“%d%f%d”,10,23.2,54);
printf(“%d%d”,100,300,200);

Powered by k2schools