Showing posts with label array input and output in C#. Show all posts
Showing posts with label array input and output in C#. Show all posts

Tuesday, October 25, 2016

Array Input and Output in C#

Here is a short and simple program that I wrote in C# that will show you how to use one dimensional array. In this program it will ask the user to give five numbers. The five given number by our user will display at the screen using one dimensional array as our data structu

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace array_input_output
{
    class array_input_output
    {
        static void Main(string[] args)
        {
            int[] rollno = new int[6];
            Console.Write("Array Input and Output in C#");
            Console.Write("\n\n");
           
            for (int s = 1; s <=5 ; s++)
            {
                Console.Write("Enter value in item no. {0} : ", s);
               rollno[s] = Convert.ToInt32(Console.ReadLine());
             }
            Console.Write("\n\n");
            Console.Write("The List of Items Values ");
            Console.Write("\n\n");
            for (int j = 1; j <= 5; j++)
            {
                Console.Write(" {0} ", rollno[j]);
            }
            Console.Write("\n\n");
            Console.Write(" End of Program ");
            Console.ReadLine();
        }
    }
}