Here, we have a basic program example to print name, date of birth, and mobile number using different languages. This program is created in c language, c++, Java, and Python.
Program to print name in C Language.
#include<stdio.h>
int main()
{
char name[10];
int date, mon, year;
long double mobile;
printf("Name: ");
gets(name);
printf("Date: ");
scanf("%d", &date);
printf("Month: ");
scanf("%d", &mon);
printf("Year: ");
scanf("%d", &year);
printf("Mob_no: ");
scanf("%Lf", &mobile);
printf("Hi %s!! \nYour DOB is %d/%d/%d and mobile number is %lf", name, date, mon, year, mobile);
return 0;
}
Program to print name in C++ Language.
#include<iostream.h>
#include<conio.h>
void main()
{
int name, date, mon, year, mobile;
clrscr();
cout<<"enter the name"<<endl;
cin>>name;
cout<<"enter the date"<<endl;
cin>>date;
cout<<"enter the month "<<endl;
cin>>mon;
cout<<"enter the year"<<endl;
cin>>year;
cout<<"enter the mobile number"<<endl;
cin>>mobile;
cout<<"the name is"<<name;
cout<<"the date of birth is"<<date<<”/”<<mon<<”/”<<year;
cout<<"the mobile number is"<<mobile;
getch();
}
Program to print name in Python Language.
print(“Enter your name: ” , end = “ ”)
name=input()
print(“Enter your date of birth: ”, end = “ ”)
dob=input()
print(“Enter your mobile number: ” end = “”)
mobile=input()
print(“The details you entered: ”)
print(“Name: ”, name)
print(“Date Of Birth: ” , dob)
print(“Mobile Number: ”, mobile)
Program to print name in Java Language.
import java.util.*;
class student_Detail
{
public static void main()
{
Scanner s=new Scanner(System.in);
System.out.println("Enter your name :");
String name=s.nextLine();
System.out.println("Enter your date of birth :");
String dob=s.nextLine();
System.out.println("Enter your contact number :");
String mobile=s.nextLine();
System.out.println("Name :"+name);
System.out.println("Age :"+dob);
System.out.println("Year of birth :"+mobile);
}
}