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
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.");
}
}
}
}
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