Code->
using System;
// Class Declaration
class StudentBirthYear {
// Instance Variables
String[] names=new String[10];
int[] BirthYears=new int[10];
// Method 1
public void input()
{
//take input from user of all ten student
for(int i=0;i<10;i++)
{
Console.WriteLine("Enter the name of "+ (i+1) +" student ");
names[i]=Console.ReadLine();
Console.WriteLine("Enter the birth year of "+ (i+1) +" student ");
String val=Console.ReadLine();
BirthYears[i] = Convert.ToInt32(val);
}
}
//output details of each student
public void output()
{
for(int i=0;i<10;i++)
{
Console.WriteLine("The name of "+ (i+1) +" student is "+names[i]);
Console.WriteLine("The birth year of "+ (i+1) +" student is "+BirthYears[i]);
}
}
// Main Method
public static void Main(String[] args)
{
// Creating object
StudentBirthYear students=new StudentBirthYear();
students.input();
students.output();
}
}
output->
NOTE-> FOR ANY DOUBTS AND QUERIES DO COMMENT AND IF YOU LIKED MY ANSWER PLEASE UPVOTE.
Get Answers For Free
Most questions answered within 1 hours.