Answer:
a while loop
Explanation:
A while loop runs if it's expression is true
Answer:
In this question the ans variable data-type is int,that is wrong.
Explanation:
In the above code the ans variable int that is used for taking integer value. and In the switch statement, we pass the value that is character so the program will give the error. To solve this error we will declare the ans variable as char and taking input from the scanner class like this (ans = scan.next().charAt(0); )where ans is variable, scan is the object of scanner class and next().charAt(0) is used to take input. that is store in ans variable.
Answer:
//Code is created using java
import java.util.*;
// returns the sum
public int sum(int N)
{
if(N==1)
return (1);
else
return N+sum(N-1);
}
// code to return the Bipower ouput
public int BiPower(int N)
{
if(N==1)
return (2);
else
return 2*BiPower(N-1);
}
// Code to return TimesFive output
public int TimesFive(int N)
{
if(N==1)
return 5;
else
return 5 + timesFive(N-1);
}
public static void main(String args[])
{
//Prompts the user to enter a nonnegative integer
int N = Integer.parseInt.(console.readLine("Enter a nonnegative integer: "));
//Outputs the sum, Bipower and TimesFive
System.out.println(sum(n));
System.out.println(BiPower(n));
System.out.println(TimesFive(n));
}
}
Android, many phone brands use the Android OS. Unlike Apple, which is the only technology company with IOS.