Computer Science, asked by dynamicsashish67, 10 months ago

*
*
*
*
*
A. In a competitive examination, a set of 'N' number of questions results in 'True'
or 'False'. Write a program by using scanner class to accept the answers. Print
the frequency of 'True' and 'False'.​

Attachments:

Answers

Answered by ns4670734
1

import java.util.Scanner;

public class brainly_app

{

public static void main()

{

Scanner x=new Scanner(System.in);

int n;

System.out.println"enter number of results";

n=x.nextInt();..............

please mark brainliest answer

Answered by kingcobra1
7

Answer:

importJava.util.*

public class truefalse

{

public static void main()

{

Scanner sc=new Scanner(System.in);

int n=sc.nextInt();

int i;int s1=0;int s2=0;

for(i=1;i<=n;i++)

{

boolean a =sc.nextBoolean();

if(a==true)

{

s1++;

}

else

{

s2++;

}

}

System.out.println("frequency of true is"+s1);

System.out.println("frequency of false is"+s2);

}

}

Similar questions