0% found this document useful (0 votes)
5 views7 pages

Codedecode Classix

Uploaded by

Vanita Karthik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views7 pages

Codedecode Classix

Uploaded by

Vanita Karthik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Given two positive numbers M and N, such that M is between 100 and 10000 and N is less than 100.

Find the smallest integer that is greater than M and whose digits add up to N. For example, if M =
100 and N = 11, then the smallest integer greater than 100 whose digits add up to 11 is 119.

Write a program to accept the numbers M and N from the user and print the smallest required
number whose sum of the digits is equal to N. Also, print the total number of digits present in the
required number. The program should check for the validity of the inputs and display an appropriate
message for an invalid input. Test your program with the sample data and some random data:

Example 1

Input:

M = 100

N = 11

Output:

The required number = 119

Total number of digits = 3

Example 2

Input:

M = 1500

N = 25

Output:

The required number = 1699

Total number of digits = 4

Example 3

Input:

M = 99

N = 11

Output:

Invalid Input

Example 4

Input:

M = 112

N = 130

Output:
Invalid Input

Shinchan has come to a mall with his mother. After requesting several times his mother has allowed
him to get one item from the vending machine. In the vending machine, firstly the coin has to be
inserted and then choice of condiment has to be made. The condiments are arranged in a tabular
form (in rows and columns). Shinchan has made his choice and inserted the row number and column
number. Output the name of the condiment selected by him. Use switch case to achieve the task.

Vending machine is arranged as (3 rows(numbered from 1-3) and 3 columns(numbered from 1-3)):

Chips | Namkeen | Chocolate

Cold Coffee | Fanta | Pepsi

Biscuit | Ice cream | Coca Cola

NOTE: If the row or column input is out of range, output "Invalid Input".

Input Format

Two space seperated integers

Constraints

None

Output Format

A single string

Sample Input 0

11

Sample Output 0
Chips

Sample input 2

33

Output

Coca Cola

Students in Amity college have last two periods on Monday and Thursday reserved for labs. Students
have to attend the labs according to the day of the week, their department and the group they
belong to. Students get confused and often go to the incorrect lab. Help them out by creating a code
that takes three inputs:

Day of the week given as (Monday, Thursday)

Department given as (CSE, ECE, MECH)

Group given as (A,B)

Time Table for CSE:

Monday Group A: Java | Group B: C++

Thursday Group A: C++ | Group B: Java

Time Table for ECE:

Monday Group A: C | Group B: Python

Thursday Group A: Python | Group B: C

Time Table for MECH:

Monday Group A: Central Workshop | Group B: Machine Design

Thursday Group A: Machine Design | Group B: Central Workshop

NOTE:

For invalid day, output should be "Invalid Day".

For invalid dept, output should be "Invalid Dept".

For invalid group, output should be "Invalid Group".


Input Format

Three Lines of input are given:

A string for day of the week.

A string for Department

A character for Group

Constraints

None

Output Format

A single string

Sample Input 0

Monday

CSE

Sample Output 0

Java

Sample Input 1

Thursday

ECE

Sample Output 1

C
Sample Input 2

Monday

MECH

Sample Output 2

Central Workshop

https://www.hackerrank.com/contests/victorypoint-conditional-statements/challenges/filters/
page:2

In a theater, there is a discount scheme announced where one gets a 10% discount on the total cost
of tickets when there is a bulk booking of more than 20 tickets, and a discount of 2% on the total
cost of tickets if a special coupon card is submitted. Develop a program to find the total cost as per
the scheme. The cost of one k class ticket is ₹75 and one q class is ₹150. Refreshments can also be
opted for by paying an additional of ₹50 per member.

Hint: A minimum of 5 and a maximum of 40 tickets have to be booked at a time else display
“Minimum of 5 and Maximum of 40 tickets have to be booked”. If class other than 'k' or 'q' is given,
output should be “Invalid Input”.

The ticket cost should be printed upto two decimal places.

Input Format

Four lines will be given as input:

Line 1: An integer of number of tickets

Line 2: A single character (y/n) for refreshments

Line 3: A single character (y/n) for coupon code


Line 4: A single character (k/q) for class

Constraints

None

Output Format

A single number(double).

Sample Input 0

35

Sample Output 0

6475.00

Explanation 0

Price calculation:

Number of tickets = 35

Refreshments = 'y'

Coupon code = 'n'

Class = 'q'

Total Cost of 35 tickets of q class = (35 * 150) = 5250

Bulk Discount = 10% of 5250 = 525

Refreshment Cost = 50*35 = 1750

Total Cost = 5250 - 525 + 1750 = 6475.00

Sample Input 1
14

Sample Output 1

1729.00

Explanation 1

Price calculation:

Number of tickets = 14

Refreshments = 'y'

Coupon code = 'y'

Class = 'k'

Total Cost of 14 tickets of k class = (14 * 75) = 1050

Coupon code discount = 2% of 1050 = 21

Refreshment Cost = 50*14 = 700

Total Cost = 1050 - 21 + 700 = ₹1729.00

https://www.hackerrank.com/contests/2d-array-patterns-practice/challenges

You might also like