Computer Science, asked by darky8711, 10 months ago

Write a program to enter students name roll number and marks in 3 subjects calculate total and percentage of marks and print a message you are passed if percentage is greater than 40, otherwise print you are failed in Visual Basic

Answers

Answered by poojarakholiya2610
9

Answer:

using System;

class d1

{

 public static void Main()

  {

    Console.WriteLine("enter student id:");

    int id;

    id=Convert.ToInt32(Console.ReadLine());

    Console.WriteLine("stud id:"+id);

    Console.WriteLine("enter your name:");

    string name;

    name=Console.ReadLine();

    Console.WriteLine("your name:"+name);

    Console.WriteLine("enter sub:");

    int m1,m2,m3;

    m1=Convert.ToInt32(Console.ReadLine());

    m2=Convert.ToInt32(Console.ReadLine());

    m3=Convert.ToInt32(Console.ReadLine());

    Console.WriteLine("m1:"+m1);

    Console.WriteLine("m2:"+m2);

    Console.WriteLine("m3:"+m3);

     

    int total;

    float per;

    total=m1+m2+m3;

    per=total/3;

    Console.WriteLine("per"+per);

     

    if(per>=40)

    {

      Console.WriteLine("pass");

    }

 

    else

    {

     Console.WriteLine("fail");

    }

 

  }

}

Explanation:

Similar questions