Get name and age and print it

 Get name and age and print it


C Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
    char name[20];
    int age;
   printf("Enter Your name:");
   scanf("%s",&name);
    printf("Enter Your age:");
   scanf("%d",&age);
   printf(" Name: %s \n Age:%d",name,age);

}


import java.util.Scanner;

public class Simpleprogram {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		System.out.print("Enter Your Name:");
		String Name = s.nextLine();
		System.out.print("Enter Your Age:");
		int Age = s.nextInt();
		System.out.print("name: "+ Name + "\nAge: "+ Age);


	}

}


Python Program
name = input("Enter your name: ")
age = int(input("Enter your age: "))

print("\nYour name is " + name)
print("\nYour age is " + str(age))

1 comment: