In a class of 'N' number of students the number of girls is 'm' ..write a program to input the value of n and m.. find the percentage of boys and girls in the class
Answers
Answered by
11
the total number of students be x
Percentage of female students = 44%
So, percentage of boys = 100 – 44 = 56%
Number of boys = 42
56% of x = 42
or (56 * x)/100 = 42
or x = 4200/56 = 75
Percentage of female students = 44%
So, percentage of boys = 100 – 44 = 56%
Number of boys = 42
56% of x = 42
or (56 * x)/100 = 42
or x = 4200/56 = 75
divyanshi261:
u have to write program in Java
Answered by
35
Answer:
THIS PROGRAM IS WRITTEN BY USING INPUT STREAM READER
//To find and display the percentage of boys and girls
import java.io.*;
class number
{
public static void main(String args [ ])throws IOException
{
InputStreamReader read=new InputStreamReader(System.in);
int n,m,b;
double perg,perg ;
System.out.println(" Enter number of student and girls");
n=Integer.parseInt(in.readLine ( ) );
m=Integer.parseInt(in.readLine ( ) );
b=n-m;
perb=(double)b/n*100;
perb=(double)m/n*100;
System.out.println("Percentage of Boys="+perb);
System.out.println("Percentage of girls="+perb);
}
}
Similar questions