Complete the code to print the text "Hello, World!".
#include <stdio.h> int main() { [1]("Hello, World!\n"); return 0; }
The printf function is used in C to print formatted output to the screen.
Complete the code to print the integer variable 'num' using printf.
#include <stdio.h> int main() { int num = 10; printf("[1]\n", num); return 0; }
The format specifier %d is used to print integers in C.
Fix the error in the printf statement to correctly print a float variable 'pi'.
#include <stdio.h> int main() { float pi = 3.14; printf("Value of pi: [1]\n", pi); return 0; }
The format specifier %f is used to print floating-point numbers in C.
Fill both blanks to print a character and an integer using printf.
#include <stdio.h> int main() { char letter = 'A'; int number = 5; printf("Character: [1], Number: [2]\n", letter, number); return 0; }
%c prints a character and %d prints an integer in C.
Fill all three blanks to print a string, an integer, and a float using printf.
#include <stdio.h> int main() { char name[] = "Bob"; int age = 25; float height = 5.9; printf("Name: [1], Age: [2], Height: [3]\n", name, age, height); return 0; }
%s prints strings, %d prints integers, and %f prints floats in C.
