// making the class
class Counter {
int counter;
int limit;
// Constructor
Counter(int a, int b){
counter = a;
limit = b;
}
// static function to increment
static increment(){
if(counter<limit)
nCounter+=1;
}
// Decrement function
void decrement(){
if(counter>0)
nCounter-=1;
}
int getValue(){
return counter;
}
static int nCounter;
int getNCounters(){
return nCounter;
}
};
// Initializa the static
int Counter::nCounter = 0;
import java.util.Scanner;
public class JavaApplication42 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int count = 0;
System.out.println("Enter an integer between 0 and 100");
int num = scan.nextInt();
if (num <= 0 || num >= 100){
System.out.println("error");
}
else{
while(num <= 100){
if (count == 20){
System.out.println("");
count = 0;
}
else{
System.out.print(num+" ");
count++;
num++;
}
}
}
}
}
I hope this helps!
Answer:
bananas and apples bananas and apples?
Explanation: