1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Input the subject and find total numberof marks and percentage

Discussion in 'C#' started by Patel, May 22, 2011.

  1. Patel

    Patel New Member

    Joined:
    Dec 5, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Lucknow
    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    
    namespace division
    {
        class Program
        {
            static void Main(string[] args)
            {
               Double hindi, eng, math, total, per;
                Console.WriteLine("Enter the marks of hindi");
                hindi = Double.Parse(Console.ReadLine());
                Console.WriteLine("Enter the marks of eng");
                eng = Double.Parse(Console.ReadLine());
                Console.WriteLine("Enter the marks of math");
                math = Double.Parse(Console.ReadLine());
                total=hindi+math+eng;
                per=total/3;
                Console.WriteLine("hindi  {0}",hindi);
                Console.WriteLine("math  {0}", math);
                Console.WriteLine("eng  {0}", eng);
                Console.WriteLine("total  {0}", total);
                Console.WriteLine("percentage  {0}",per);
                if (per >= 60)
                {
                    Console.WriteLine("First");
                }
                else if (per >= 50)
                {
                    Console.WriteLine("Second");
                }
                else
                {
                    Console.WriteLine("Fail");
                }
                Console.ReadLine();
            }
        }
    }
    <Amit Patel>
     
    Last edited by a moderator: May 22, 2011

Share This Page