0
using System;


namespace ConsoleApplication1
{
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("hi..! :)");
        Console.WriteLine("Welcome to 1st program of console by ali which is marksheet...:P ;)");
        Console.WriteLine("Enter the marks of subjects..");

        Int32[] array = new int[5];

        Console.WriteLine("Enter the marks of Maths..!");
        array[0] = Convert.ToInt32(Console.ReadLine());

        Console.WriteLine("Enter the marks of Arabic..!");
        array[1] = Convert.ToInt32(Console.ReadLine());

        Console.WriteLine("Enter the marks of English..!");
        array[2] = Convert.ToInt32(Console.ReadLine());

        Console.WriteLine("Enter the marks of Science..!");
        array[3] = Convert.ToInt32(Console.ReadLine());

        Console.WriteLine("Enter the marks of Physics..!");
        array[4] = Convert.ToInt32(Console.ReadLine());

        for(Int32 i=0 i < array.Length i++)
        {
            Console.WriteLine(i + " is the obtained marks from 500..");
        }

        Console.ReadKey();
    }
}

}

Rick S
  • 6,476
  • 5
  • 29
  • 43
Ali Asim
  • 3
  • 2
  • It means you are missing a `;` It looks like your for loop should read: `for (Int32 i=0; i < array.Length; i++)` – dub stylee Feb 18 '15 at 21:13

1 Answers1

1

Change your for loop from:

for(Int32 i=0 i < array.Length i++)
{
    Console.WriteLine(i + " is the obtained marks from 500..");
}

To:

for(Int32 i=0; i < array.Length; i++)
{
    Console.WriteLine(array[i].ToString() + " is the obtained marks from 500..");
}

Also, it is not commonly good practice to use "array" as a variable name in any language. You may want to change the array variable name to something more like myArray or my_array.

William Callahan
  • 630
  • 7
  • 20
  • thanks william..! i'll try to make it good. Now loop is working, but the array is not working in loop.. – Ali Asim Feb 18 '15 at 21:16
  • Try calling the .ToString() method. I forgot to add that before and it may not compile unless you explicitly cast the Int32 to a string. – William Callahan Feb 18 '15 at 21:26