Computer Science, asked by RehanAhmadXLX4849, 1 year ago

The number of users logged in is in a variable called users. how would you test to see if 5 users are logged in?

Answers

Answered by hermioneslaysx
1
you run a loop. If the language you use is Java, then
import java.util.*;
class users
{
    public static void main ()
    {
        Scanner sc=new Scanner (System.in);
        int i,users;
        System.out.println("Enter the number of users logged in:");
        users=sc.nextInt();
           for(i=1; i<=users; i++)
           {
                 if (users==5)
                 {
                       System.out.println("5 users are logged in.");
                 }
                 else
                 {
                    System.out.println("The Criteria is false.");
                 }
}
}
}
Similar questions