Computer Science, asked by Ankita0406, 8 months ago

Write a program in Java to input the name and marks of a student in four subjects and print the percentage of obtained.

Please text if you know the answer.​

Answers

Answered by Anonymous
3

Answer:

\huge\mathbf\red{Question:-}

Write a program in Java to input the name and marks of a student in four subjects and print the percentage of obtained.

\huge\mathbf\green{Answer:}

import java.io.*;

class percentage

{

public static void main() throws IOException

{

DataInputStream in=new DataInputStream(System.in);

String n=" ";

int s1=0,s2=0,s3=0,s4=0,t=0;

double p=0;

System.out.print("Enter student's name....");

n=in.readLine();

s1=Integer.parseInt(in.readLine());

System.out.print("Enter 2nd subject.....");

s2=Integer.parseInt(in.readLine());

System.out.print("Enter 3rd subject.....");

s3=Integer.parseInt(in.readLine());

System.out.print("Enter 4th subject.....");

s4=Integer.parseInt(in.readLine());

t = s1+s2+s3+s4;

p = t/400*100;

System.out.print("Name of the student....."+n);

System.out.print("Percentage obtained......"+p);

Hope it helps you......

Similar questions