Write C# Program to calculate the total marks, percentage and division of student based on three subjects


Introduction

Write C# Program to calculate the total marks, percentage and division of student based on three subjects. I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. public class csharpExercise
  7. {
  8. static void Main(string[] args)
  9. {
  10. double rl, phy, che, ca, total;
  11. double per;
  12. string nm, div;
  13.  
  14. Console.Write("\n\n");
  15. Console.Write("Calculate the total, percentage and division to take marks of three subjects:\n");
  16. Console.Write("-------------------------------------------------------------------------------");
  17. Console.Write("\n\n");
  18.  
  19.  
  20. Console.Write("Input the Roll Number of the student :");
  21. rl = Convert.ToInt32(Console.ReadLine());
  22.  
  23. Console.Write("Input the Name of the Student :");
  24. nm = Console.ReadLine();
  25.  
  26. Console.Write("Input the marks of Physics : ");
  27. phy = Convert.ToInt32(Console.ReadLine());
  28. Console.Write("Input the marks of Chemistry : ");
  29. che = Convert.ToInt32(Console.ReadLine());
  30. Console.Write("Input the marks of Computer Application : ");
  31. ca = Convert.ToInt32(Console.ReadLine());
  32.  
  33. total = phy + che + ca;
  34. per = total / 3.0;
  35. if (per >= 60)
  36. div = "First";
  37. else
  38. if (per < 60 && per >= 48)
  39. div = "Second";
  40. else
  41. if (per < 48 && per >= 36)
  42. div = "Pass";
  43. else
  44. div = "Fail";
  45.  
  46. Console.Write("\nRoll No : {0}\nName of Student : {1}\n", rl, nm);
  47. Console.Write("Marks in Physics : {0}\nMarks in Chemistry : {1}\nMarks in Computer Application : {2}\n", phy, che, ca);
  48. Console.Write("Total Marks = {0}\nPercentage = {1}\nDivision = {2}\n", total, per, div);
  49.  
  50. Console.ReadLine();
  51. }
  52. }

Result

C# language techstudy.org

     





Related Topics




Popular Posts