## Java Program(dynamic dispatch+super()+object as parameter)

Example of dynamic dispatch+super()+object as parameter in Java import java.util.Scanner; class Student { String[] name, branch; int[] roll_no; int x; Scanner sc = new Scanner(System.in); Student(int n) { x = n; } void get() { int i; name = new String[x]; roll_no = new int[x]; branch = new String[x]; for Read more…

## 100 doors problem(Modified) using Python

Problem Statement:- There are 100 doors and a person walks through it in such a way that:- In first walk he opens first door In second walk he opens each door that is a multiple of two but close door 2 later. …………………………………… ………………………………….. Similarly in i-th walk he opens Read more…

## Check if count of even and odd divisors of a number are equal or not

Problem Statement:- Your task is simple.Given a number(say,n) find if it’s number of odd divisors are equal to it’s number of even divisors. For Example:-Let’s say the number is 6. The divisors of 6 are:-1,2,3 and 6. Here number of odd divisors=2(1 and 3) and number of even divisors=(2 and Read more…

## n doors problem using Python

Reference:- https://freshlybuilt.com/100-doors-problem-using-python/ Problem Statement This is a general form of 100 doors problem.Here you have n doors.All doors are initially closed.m persons walk through all the doors and toggle them(open if close and vice-versa). Person 1 walks and toggle(open) all doors. Person 2 walks and toggle each door that is Read more…

## 100 doors problem Using Python

Reference:- https://www.geeksforgeeks.org/puzzle-16-100-doors/ Problem Statement There are 100 doors in a row, all doors are initially closed. A person walks through all doors multiple times and toggle (if open then close, if close then open) them in following way: In first walk, the person toggles every door In second walk, the Read more…

## Write a program to print first n prime numbers in Java.

AIM: – Write a program to print first n prime numbers in Java. Prime Number: AÂ prime numberÂ is a wholeÂ numberÂ greater than 1 whose only factors are 1 and itself. A factor is a wholeÂ numbersÂ that can be divided evenly into anotherÂ number. The first fewÂ prime numbersÂ are 2, 3, 5, 7, 11, 13, 17, Read more…

## Write a program to check whether a given number is prime in Java

AIM: – Write a program to check whether a given number is prime. Prime Number: A prime number is a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. Read more…

## Monty Hall Problem Solution Using Python

Reference:- https://en.wikipedia.org/wiki/Monty_Hall_problem Problem Statement Suppose you’re on a game show, and you’re given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No.Â 1, and the host, who knows what’s behind the doors, opens another door, say No.Â 3, which has Read more…

## Write a program to find maximum of three numbers in Java

AIM: – Write a program to find maximum of three numbers. Here we are writing about Write a program to find maximum of three numbers in Java. Our initiative is that user understand code by reading comment so that he/she can became capable to any understand code in this programming Read more…

## Write a program to print grades for given input percentage from command line using nested if else in Java

AIM: – Write a program to print grades for given input percentage from command line using nested if else. Here we are writing about Write a program to print grades for given input percentage from command line using nested if else in Java. Our initiative is that user understand code Read more…