Subscribe to:
Post Comments (Atom)
Write a python function, find_correct() which accepts a dictionary and returns a list as per the rules mentioned below. The input dictionary will contain correct spelling of a word as key and the spelling provided by a contestant as the value.
Write a python function, find_correct() which accepts a dictionary and returns a list as per the rules mentioned below. The input diction...
-
The Metro Bank provides various types of loans such as car loans, business loans and house loans to its account holders. Write a python pr...
-
Question: FoodCorner home delivers vegetarian and non-vegetarian combos to its customer based on order. A vegetarian combo costs Rs.120 pe...
-
Question: You have x no. of 5 rupee coins and y no. of 1 rupee coins. You want to purchase an item for amount z. The shopkeeper wants you ...
Great solution, Keep Posting.
ReplyDelete// Solution in JAVA programming language
ReplyDeletepackage tcsNqtPractice;
import java.util.Scanner;
public class Assignment44 {
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Enter the Number: ");
int num = scan.nextInt();
int value = 2;
int rem = 0;
while(true) {
rem = noOfDivisors(value);
if(rem == num) {
System.out.println("The No. with divisors: "+ value);
break;
}else {
value = value + 1;
}
}
}
public static int noOfDivisors(int n) {
int count = 0;
for(int i=1; i<=n; i++) {
if(n%i == 0) {
count ++;
}
}
return count;
}
}