codegurukool.com · Free coding tutorials & online compiler

Home › C Tutorial › C output

C output

Print with printf.

printf prints text. \n starts a new line and \t adds a tab. Format codes insert values: %d int, %f float, %c char, %s string.

Example code

#include <stdio.h>
int main() {
  printf("Line 1\nLine 2\n");
  printf("Age %d, pi %.2f, grade %c\n", 20, 3.14159, 'A');
  return 0;
}

Run this code in the online editor

← C syntaxC comments →