Computer Applications

In a competitive examination, there were 150 questions. One candidate got 80% correct and the other candidate 72% correct. Write a program to calculate and display the correct answers each candidate got.

Java

Java Operators

168 Likes

Answer

public class KboatCompetitiveExam
{
    public static void main(String args[]) {
        int totalQuestions = 150;
        int c1 = (int)(80 / 100.0 * totalQuestions);
        int c2 = (int)(72 / 100.0 * totalQuestions);
        System.out.println("Correct Answers of Candidate 1 = " + c1);
        System.out.println("Correct Answers of Candidate 2 = " + c2);
    }
}

Variable Description Table

Program Explanation

Output

Answered By

85 Likes


Related Questions