0% found this document useful (0 votes)
41 views3 pages

Coding Challenges - IITBx

The document contains 50 coding challenge problems with sample inputs and outputs. The problems include basic mathematical operations, conditional statements, data type conversions, series calculations and more. The cheat codes provide hints on concepts or functions that could help solve the problems.

Uploaded by

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

Coding Challenges - IITBx

The document contains 50 coding challenge problems with sample inputs and outputs. The problems include basic mathematical operations, conditional statements, data type conversions, series calculations and more. The cheat codes provide hints on concepts or functions that could help solve the problems.

Uploaded by

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

Q No.

Coding challenge Sample Input Sample Output Cheat Code


9
5
14
calculate sum, difference, product, division and remainder of two numbers, and print the result on the 7 3 use % operator to get the remainder of
1 screen 2 1 division
2 Take a number a meters, convert it to centimeters, then print it on the screen 2 200
3 Take number of kilmeters , convert it to centimeters, then print it on the screen 2 200000
4 Take number of inches , convert it to feet, then print it on the screen 60 5
12.5664
5 Take radius of a circle , calcualte its perimeter and area, then print it on the screen 4 50.2654 use float data type
24
6 Take side of a square , calcualte its perimeter and area, then print it on the screen 6 36
4 22
7 Take length and breadth of a rectangle , calcualte its perimeter and area, then print it on the screen 7 28
8 Take a number (say 'n') , calculate sum of first 'n' odd numbers, print it on the screen 4 16
9 Take a number (say 'n') , calculate the 'nth' odd number, print it on the screen 4 7
10 Take a number (say 'n') , calculate sum of first 'n' even numbers, print it on the screen 4 20
11 Take a number (say 'n') , calculate the 'nth' even numbers, print it on the screen 4 8
Take a number (say 'n') , calculate sum of first 'n' terms of following series, print it on the screen
12 5 7 9 11 13 ....... 4 32
Take a number (say 'n') , calculate the 'nth' term of following series, print it on the screen
13 5 7 9 11 13 ....... 4 11
Take a number (say 'n') , calculate sum of first 'n' terms of following series, print it on the screen
14 3 7 11 15 19 23 ....... 4 36
Take a number (say 'n') , calculate the 'nth' term of following series, print it on the screen
15 3 7 11 15 19 23....... 4 15
48 219
16 Take two number, swap the values of these variables, print it on the screen 219 48
Write a program to count minimum number of notes required for a given amount(valid notes are
17 2000,500,100, 50, 20, 10, 5, 1). 4553 7
1 Year Assume
Write a program to take number of days as input and convert it into years, months and weeks 1 Month 365 days in a year.
18 (Assume all years have 365 days and all months have 30 days) 400 5 Days 30 days in a month
60
19 Write a program to take two angles of a triangle as input and find the third angle 90 30 Recall rules of trigonometry
20 Write a program to enter base and height of a triangle and find its area
21 Write a program to calculate area of an equilateral triangle
Write a program to take marks of five subjects (maximum marks that can be scored are 75) and
22 calculate total, average and percentage
23 Write a program to enter Principal, Time, Rate, calculate & print Simple Interest
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Q No. Problem Description Sample Input Sample Output Cheat Code
2
1 Take 2 numbers as input from user, print the largest number on the screen 6 6
3
7
2 Take 3 numbers as input from user, print the largest number on the screen 2 7
3 Take the age of the user as input, print if the user is a teenager 15 Teenager: Beware of my Tantrums
4 Lets get Even

4 Take a number as an input, print if the number is odd or even 9 Odd one out
2004 Yay!!! One extra day to live your life.

5 Take the year as an input, print on the screen if it is a Leap year 2007 Get paid for the whole month while working for 28 days only :-)
3 Infants: Soo Cute

15 Teenager: Beware of my Tantrums

45 Others: Damnn!!!!!
Take the age of the user as input, print if the user is an infant (Age 0-5) or teenager
6 (Age 13-19), a senior citizen (>60), or Others 67 Senior Citizen: Earn extra interest on fixed deposits
Write a program to create a basic calculator.
Provide a menu with 4 options to the user and let the user choose one of the options[1-
4].
After the user has chosen the option take 2 more numbers as input from the user.
Perform the operation that user has chosen in first step.

1. Add
2. Subtract 1
3. Multiply 7
7 4. Divide 8 15
Take the price of an item as input from the user. Also take input the rate of GST on the 100
8 item. print the final price of the item by adding GST amount to the price. 15 115
5 Positive

0 Zero

9 Write a program to check whether a number is negative, positive or zero. -8 Negative


60 Yes

10 Write a program to check whether a number is divisible by 5 and 11 or not. 110 No


use data type char.

a English e.g.

11 Write a program to check whether a character is a letter of English alphabet or not. 5 Not English char sampleChar = 'a';
e Vowel

12 Write a program to input any letter and check whether it is a vowel or consonant. m Consonant
d
English
&
Special Character
Write a program to input any character and check whether it is an English letter, digit or 5
13 special character. Digit
a Lower Case

14 Write a program to check if a user input character is upper case of lower case letter D Upper Case
Take code price and selling price of an item as input. Write a program to calculate profit
15 or loss.
4 Thursday
Write a program to input week number and print week day (Week starts on Monday and
16 ends on Sunday). 7 Sunday
17 Write a program to input month number and print number of days in that month. 5 31
30
60 It is a triangle
90

20
40 It is not a triangle
18 Write a program to input angles of a triangle and check whether triangle is valid or not. 60
3
3 equilateral
3

3
3 isosceles
6

4
Write a program to check whether the triangle is equilateral, isosceles or scalene 5 scalene
19 triangle. 6
Write a program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer.
Calculate percentage and grade according to following:
Percentage >= 90% : Grade A
Percentage >= 80% : Grade B
Percentage >= 70% : Grade C
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E
20 Percentage < 40% : Grade F
Write a program to input basic salary of an employee and calculate its Gross salary
according to following:
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
21 Basic Salary > 20000 : HRA = 30%, DA = 95%
Write a program to input electricity unit charges and calculate total electricity bill
according to the given condition:
For first 50 units Rs. 0.50/unit
For next 100 units Rs. 0.75/unit
For next 100 units Rs. 1.20/unit
For unit above 250 Rs. 1.50/unit
22 An additional surcharge of 20% is added to the bill
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

You might also like