C Program to Print Your Name, Date of Birth, and Mobile Number
Are you just starting your journey into the world of C programming? One of the first and most fundamental steps is learning how to display information. This simple C program will show you exactly how to print your name, date of birth, and mobile number directly to the console using the essential printf() function. It's a perfect starting point to understand how output works in C.
#include <stdio.h> int main() { // Display personal details printf("Name : John Doe\n"); printf("DOB : 01/01/2000\n"); printf("Mobile No. : +91-9876543210\n"); return 0; } Output Name : John Doe DOB : 01/01/2000 Mobile No. : +91-9876543210
Explanation – How This Program Works
This is one of the most basic and beginner-friendly programs in C. It helps you practice the use of the printf() function, which is used to display output on the screen.
Line-by-line Breakdown:
#include <stdio.h>
This is a standard header file. It gives your program access to input/output functions like printf(). Think of it as importing a library of tools for your program to use.
int main()
Every C program starts execution from the main() function. This is where your program's instructions begin.
printf(...)
This function is used here to print static text — your name, birthdate, and mobile number. You can easily replace the placeholder values ("John Doe", "01/01/2000", "+91-9876543210") with your actual details to personalize the output.
\n
This is a newline character. It acts like hitting the "Enter" key on your keyboard, moving the output to the next line for cleaner, more organized formatting.
return 0;
This statement tells the operating system that the program finished successfully. A return value of 0 typically indicates no errors occurred.
Conclusion
Congratulations! You've just created and understood your first fundamental C program for displaying personal information. Mastering the printf() function is crucial for any C programmer, as it's your primary tool for communicating with the user and debugging your code. Experiment with printing different types of information and see how you can format it using characters like \n. Keep practicing, and you'll build a strong foundation in C programming in no time!