Challenge: Three Lines About Me
Completed
Print these three lines, exactly as shown:
Name: Sam City: Pune Hobby: Chess
Input
None.
Output
The three lines above.
Example
Output
Name: Sam City: Pune Hobby: Chess
Editor
C
Hints
One printf per line is easiest.
Don't forget \n at the end of each line.
Solution explanation
Each printf prints one line because each one ends with \n.
Show solution
#include <stdio.h>
int main() {
printf("Name: Sam\n");
printf("City: Pune\n");
printf("Hobby: Chess\n");
return 0;
} Output
Answer
You can practice without logging in. Log in to save completion.
Save your progress
You're practising as a guest, so your progress won't be saved.
- Track every lab you complete
- Earn verifiable lab certificates
- See your progress in every module