This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This Program will Print out all the Prime Numbers. | |
The Program will ask you to enter the number to check wether it is Prime Number Or Not a Prime Number. | |
It will print out True If the Number is Prime and False If the Number is not Prime | |
import java.util.*; | |
public class FindPrime { | |
public static boolean CheckPrime(int input){ | |
if (input % 2 != 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1. We have a number of bunnies and each bunny has two big floppy ears. We want to compute the total number of ears across all | |
the bunnies recursively (without loops or multiplication). | |
import java.util.Scanner; | |
public class Q2 { | |
static int NumOfEars(int numOfBunnies) { | |
int num =0; | |
num = numOfBunnies + numOfBunnies; | |
return num; |