Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want user to enter the name of student & marks of their subjects respectivly.....& after that program 'll give output of percentages with name of students.
Posted
Comments
[no name] 28-Jan-13 1:43am    
Your question is not so clear...
Tharaka MTR 28-Jan-13 1:43am    
please give us more details

Hi,
Please Elaborate your problem.
You can try this formula in ur task
marks/totalmarks*100
u 'll get out put with percentages.
 
Share this answer
 
v2
C#
using System;
using System.Collections.Generic;
using System.Text;

using System.Collections.Specialized;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable ht = new Hashtable();

            int __english_max_marks = 100;
            int __maths_max_marks = 100;
            int __science_max_marks = 100;

            do
            {
                Console.WriteLine("");
                Console.Write("Enter Name Of Student : ");
                string studentName = Console.ReadLine();

                ArrayList al = new ArrayList();

                int[] ArrMarks = new int[3];

                Console.Write("Enter Marks Of English : ");
                int.TryParse(Console.ReadLine(), out ArrMarks[0]);
                Console.Write("Enter Marks Of Maths : ");
                int.TryParse(Console.ReadLine(), out ArrMarks[1]);
                Console.Write("Enter Marks Of Science : ");
                int.TryParse(Console.ReadLine(), out ArrMarks[2]);

                ht.Add(studentName, ArrMarks);

                Console.WriteLine("Would You Like To Read More Records ? Y/N");
            }
            while (Console.ReadKey().KeyChar.ToString().ToUpper() == "Y");

            Console.WriteLine("");
            Console.WriteLine("");

            foreach (string sk in ht.Keys)
            {
                int[] Arr = (int[])ht[sk];

                int all_marks = __english_max_marks + __maths_max_marks + __science_max_marks;

                float __percent = ((Arr[0] + Arr[1] + Arr[2]) * 100) / all_marks;

                Console.WriteLine(sk + " : " + __percent + " %");
            }

            Console.WriteLine("");
            Console.WriteLine("Press a key to Quit !");
            Console.ReadKey();
        }
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900