Variables and Operators - Programming
Variables and Operators - Programming
Output Format:
Output should display the welcome message along with the Customer’s name.
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output.]
Assign Groups
1 T3 helen Enter your name
Hello helen ! Welcome to Amphi Event Management System
2 TC 7 manu Enter your name
Hello manu ! Welcome to Amphi Event Management System
3 TC 6 hareesh Enter your name
Hello hareesh ! Welcome to Amphi Event Management
4 TC 5 girish Enter your name
Hello girish ! Welcome to Amphi Event Management System
5 T2 Amit Enter your name
Hello Amit ! Welcome to Amphi Event Management System
6 T4 PriyA Enter your name
Hello PriyA ! Welcome to Amphi Event Management System
SNo Name Input Output
7 TC 8 5 Enter your name
Hello 5 ! Welcome to Amphi Event Management System
8 T1 Beena Enter your name
Hello Beena ! Welcome to Amphi Event Management System
Number of events
"Pine Tree" Company has signed up a big time Event Management deal from the
Rotary Youth Club for a Trade Fair organized at Codissia Complex, wherein all
startup companies in the Software industry are demonstrating their latest products
and services and meet with industry partners and Customers.
Amphi Event Management System has to be modified to write a piece of code that
will get the input of the number of events to be hosted for the Fair at Codissia from
its users and display the same. Help the company to accomplish the requirement.
Input Format:
First line of the input is an integer that corresponds to the number of events to be
hosted at Codissia.
Output Format:
Output should display the number of events to be hosted at Codissia.
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output.]
Assign Groups
1 TC 7 5885 Enter the number of events hosted in Codissia
Number of events hosted in Codissia is 5885
2 T3 10000 Enter the number of events hosted in Codissia
Number of events hosted in Codissia is 10000
3 T2 250 Enter the number of events hosted in Codissia
SNo Name Input Output
Number of events hosted in Codissia is 250
4 TC 6 0 Enter the number of events hosted in Codissia
Number of events hosted in Codissia is 0
5 T1 50 Enter the number of events hosted in Codissia
Number of events hosted in Codissia is 50
6 TC 5 788 Enter the number of events hosted in Codissia
Number of events hosted in Codissia is 788
7 TC 4 3 Enter the number of events hosted in Codissia
Number of events hosted in Codissia is 3
Event Details
Be it a last minute get together, a birthday party or corporate events, the "Pine Tree"
Event Management Company helps you plan and execute it better and faster. Nikhil,
the founder of the company wanted the Amphi Event Management System to get
and display the event details from his Customers for every new order of the
Company.
Write a program that will get the input of the event details like name of the event,
type of the event, number of people expected, a string value (Y/N) telling whether the
event is going to be a paid entry and the projected expenses (in lakhs) for the event.
The program should then display the input values as a formatted output.
Input Format:
First input is a string that corresponds to the name of the event. Assume the
maximum length of the string as 50.
Second input is a string that corresponds to the type of the event. Assume the
maximum length of the string as 50.
Third input is an integer that corresponds to the number of people expected for the
event.
Fourth input is a character that corresponds to Y/N telling whether the event is going
to be a paid entry or not.
Fifth input is a double value that corresponds to the projected expenses (in lakhs) for
the event.
Output Format:
Output should display the event details as given in the sample output.
All double values need to be displayed correct to 1 decimal place
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output.]
Sample Input and Output:
Enter the name of the event
Food Fest 2017
Enter the type of the event
Public
Enter the number of people expected
5000
Is it a paid entry? (Type Y or N)
N
Enter the projected expenses (in lakhs) for this event
5.7
Event Name : Food Fest 2017
Event Type : Public
Expected Count : 5000
Paid Entry : N
Projected Expense : 5.7L
Test Cases
Assign Groups
1 T2 Big Boss 2017 Enter the name of the event
Private Enter the type of the event
25 Enter the number of people expected
N Is it a paid entry? (Type Y or N)
500.00 Enter the projected expenses (in lakhs) for
Event Name : Big Boss 2017
Event Type : Private
Expected Count : 25
Paid Entry : N
Projected Expense : 500.0L
2 TC 8 map Enter the name of the event
rock Enter the type of the event
345554 Enter the number of people expected
y Is it a paid entry? (Type Y or N)
33 Enter the projected expenses (in lakhs) for
Event Name : map
Event Type : rock
Expected Count : 345554
Paid Entry : y
Projected Expense : 33.0L
3 TC 7 temp Enter the name of the event
fish Enter the type of the event
3 Enter the number of people expected
y Is it a paid entry? (Type Y or N)
SNo Name Input Output
2334 Enter the projected expenses (in lakhs) for
Event Name : temp
Event Type : fish
Expected Count : 3
Paid Entry : y
Projected Expense : 2334.0L
4 TC 5 circus Enter the name of the event
match Enter the type of the event
7 Enter the number of people expected
n Is it a paid entry? (Type Y or N)
2 Enter the projected expenses (in lakhs) for
Event Name : circus
Event Type : match
Expected Count : 7
Paid Entry : n
Projected Expense : 2.0L
5 T1 Food Fest 2017 Enter the name of the event
Public Enter the type of the event
5000 Enter the number of people expected
N Is it a paid entry? (Type Y or N)
5.7 Enter the projected expenses (in lakhs) for
Event Name : Food Fest 2017
Event Type : Public
Expected Count : 5000
Paid Entry : N
Projected Expense : 5.7L
6 T3 Seminars 2017 Enter the name of the event
Public Enter the type of the event
5000 Enter the number of people expected
Y Is it a paid entry? (Type Y or N)
1.505 Enter the projected expenses (in lakhs) for
Event Name : Seminars 2017
Event Type : Public
Expected Count : 5000
Paid Entry : Y
Projected Expense : 1.5L
7 TC 6 yoga Enter the name of the event
yoga Enter the type of the event
87774 Enter the number of people expected
n Is it a paid entry? (Type Y or N)
5000 Enter the projected expenses (in lakhs) for
Event Name : yoga
Event Type : yoga
SNo Name Input Output
Expected Count : 87774
Paid Entry : n
Projected Expense : 5000.0L
8 TC 4 hall Enter the name of the event
dance Enter the type of the event
885 Enter the number of people expected
y Is it a paid entry? (Type Y or N)
52 Enter the projected expenses (in lakhs) for
Event Name : hall
Event Type : dance
Expected Count : 885
Paid Entry : y
Projected Expense : 52.0L
Assign Groups
1 TC 5 7888 Enter branding expenses
200000 Enter travel expenses
445 Enter food expenses
7885 Enter logistics expenses
Total expenses : Rs.216218.00
Branding expenses percentage : 3.65%
Travel expenses percentage : 92.50%
Food expenses percentage : 0.21%
Logistics expenses percentage : 3.65%
2 T2 200000 Enter branding expenses
40000 Enter travel expenses
300000 Enter food expenses
1000000 Enter logistics expenses
Total expenses : Rs.1540000.00
Branding expenses percentage : 12.99%
Travel expenses percentage : 2.60%
Food expenses percentage : 19.48%
Logistics expenses percentage : 64.94%
3 TC 7 0 Enter branding expenses
Enter travel expenses
2 Enter food expenses
Enter logistics expenses
Total expenses : Rs.2.00
Branding expenses percentage : 0.00%
Travel expenses percentage : 0.00%
Food expenses percentage : 100.00%
Logistics expenses percentage : 0.00%
4 TC 4 5000 Enter branding expenses
2000 Enter travel expenses
SNo Name Input Output
5447 Enter food expenses
255 Enter logistics expenses
Total expenses : Rs.12702.00
Branding expenses percentage : 39.36%
Travel expenses percentage : 15.75%
Food expenses percentage : 42.88%
Logistics expenses percentage : 2.01%
5 TC 8 -112 Enter branding expenses
-555 Enter travel expenses
555 Enter food expenses
4444 Enter logistics expenses
Total expenses : Rs.4332.00
Branding expenses percentage : -2.59%
Travel expenses percentage : -12.81%
Food expenses percentage : 12.81%
Logistics expenses percentage : 102.59%
6 T1 20000 Enter branding expenses
40000 Enter travel expenses
15000 Enter food expenses
25000 Enter logistics expenses
Total expenses : Rs.100000.00
Branding expenses percentage : 20.00%
Travel expenses percentage : 40.00%
Food expenses percentage : 15.00%
Logistics expenses percentage : 25.00%
7 TC 6 855 Enter branding expenses
877779 Enter travel expenses
5544 Enter food expenses
2256 Enter logistics expenses
Total expenses : Rs.886434.00
Branding expenses percentage : 0.10%
Travel expenses percentage : 99.02%
Food expenses percentage : 0.63%
Logistics expenses percentage : 0.25%
8 T3 20000 Enter branding expenses
30000 Enter travel expenses
10000 Enter food expenses
25000 Enter logistics expenses
Total expenses : Rs.85000.00
Branding expenses percentage : 23.53%
Travel expenses percentage : 35.29%
Food expenses percentage : 11.76%
Logistics expenses percentage : 29.41%
Trade Fair
Trade Fairs are important for companies to present their products and to get in touch
with its customers and business parties. One such grandeur Trade Fair Event was
organized by the Confederation of National Large Scale Industry.
Number of people who attended the event on the first day was x. But as days
progressed, the event gained good response and the number of people who
attended the event on the second day was twice the number of people who attended
on the first day. Unfortunately due to heavy rains on the third day, the number of
people who attended the event was exactly half the number of people who attended
on the first day.
Given the total number of people who have attended the event in the first 3 days,
find the number of people who have attended the event on day 1, day 2 and day 3.
Input Format:
First line of the input is an integer value that corresponds to the total number of
people.
Output Format:
First line of the output should display the number of attendees on day 1.
Second line of the output should display the number of attendees on day 2.
Third line of the output should display the number of attendees on day 3.
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output.]
Assign Groups
1 T2 24500 Enter the total number of people
Number of attendees on day 1 : 7000
Number of attendees on day 2 : 14000
Number of attendees on day 3 : 3500
2 TC 7 14000 Enter the total number of people
Number of attendees on day 1 : 4000
Number of attendees on day 2 : 8000
SNo Name Input Output
Number of attendees on day 3 : 2000
3 T5 7000 Enter the total number of people
Number of attendees on day 1 : 2000
Number of attendees on day 2 : 4000
Number of attendees on day 3 : 1000
4 T4 3500 Enter the total number of people
Number of attendees on day 1 : 1000
Number of attendees on day 2 : 2000
Number of attendees on day 3 : 500
5 TC 6 4998 Enter the total number of people
Number of attendees on day 1 : 1428
Number of attendees on day 2 : 2856
Number of attendees on day 3 : 714
6 TC 8 700 Enter the total number of people
Number of attendees on day 1 : 200
Number of attendees on day 2 : 400
Number of attendees on day 3 : 100
7 T1 10500 Enter the total number of people
Number of attendees on day 1 : 3000
Number of attendees on day 2 : 6000
Number of attendees on day 3 : 1500
8 T3 35000 Enter the total number of people
Number of attendees on day 1 : 10000
Number of attendees on day 2 : 20000
Number of attendees on day 3 : 5000
Assign Groups
1 TC 7 50 Enter the value of X
900 Enter the value of Y
Number of children tickets sold : 50
Number of adult tickets sold : 100
Number of senior tickets sold : 100
2 T2 20 Enter the value of X
1400 Enter the value of Y
Number of children tickets sold : 100
Number of adult tickets sold : 120
Number of senior tickets sold : 200
3 TC 8 2 Enter the value of X
30 Enter the value of Y
Number of children tickets sold : 1
Number of adult tickets sold : 3
Number of senior tickets sold : 2
4 T5 5 Enter the value of X
545 Enter the value of Y
Number of children tickets sold : 40
Number of adult tickets sold : 45
Number of senior tickets sold : 80
SNo Name Input Output
5 T4 40 Enter the value of X
1110 Enter the value of Y
Number of children tickets sold : 70
Number of adult tickets sold : 110
Number of senior tickets sold : 140
6 TC 6 5 Enter the value of X
50 Enter the value of Y
Number of children tickets sold : 1
Number of adult tickets sold : 6
Number of senior tickets sold : 2
7 T3 50 Enter the value of X
23650 Enter the value of Y
Number of children tickets sold : 1800
Number of adult tickets sold : 1850
Number of senior tickets sold : 3600
8 T1 10 Enter the value of X
700 Enter the value of Y
Number of children tickets sold : 50
Number of adult tickets sold : 60
Number of senior tickets sold : 100
Output Format:
First line of the output should display the number of hours Justin has worked during
the weekdays.
Second line of the output should display the number of hours Justin has worked
during the weekends.
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output.]
Assign Groups
1 TC 6 5000 Enter the total salary paid
Number of weekday hours is 42
Number of weekend hours is 32
2 T3 15100 Enter the total salary paid
Number of weekday hours is 120
Number of weekend hours is 110
3 T2 11200 Enter the total salary paid
Number of weekday hours is 90
Number of weekend hours is 80
4 T5 37850 Enter the total salary paid
Number of weekday hours is 295
Number of weekend hours is 285
5 TC 7 1234 Enter the total salary paid
Number of weekday hours is 13
Number of weekend hours is 3
6 TC 8 6335542 Enter the total salary paid
Number of weekday hours is 48738
Number of weekend hours is 48728
7 T1 2750 Enter the total salary paid
Number of weekday hours is 25
Number of weekend hours is 15
8 T4 24200 Enter the total salary paid
Number of weekday hours is 190
Number of weekend hours is 180
WonderWorks Magic Show
The Magic Castle, the home of the Academy of Magical Arts at California has
organized the great ‘WonderWorks Magic Show’. 3 renowned magicians were invited
to mystify and thrill the crowd with their world’s spectacular magic tricks. At the end
of each of the 3 magicians’ shows, the audience were requested to give their
feedback in a scale of 1 to 10. Number of people who watched each show and the
average feedback rating of each show is known. Write a program to find the average
feedback rating of the WonderWorks Magic show.
Input Format:
First line of the input is an integer value that corresponds to the number of people
who watched show 1.
Second line of the input is a float value that corresponds to the average rating of
show 1.
Third line of the input is an integer value that corresponds to the number of people
who watched show 2.
Fourth line of the input is a float value that corresponds to the average rating of show
2.
Fifth line of the input is an integer value that corresponds to the number of people
who watched show 3.
Sixth line of the input is a float value that corresponds to the average rating of show
3.
Output Format:
Output should display the overall average rating for the show. Display the rating
correct to 2 decimal places.
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output.]
Assign Groups
SNo Name Input Output
1 T4 50 Enter the number of people who watched show 1
2 Enter the average rating for show 1
34 Enter the number of people who watched show 2
2.7 Enter the average rating for show 2
15 Enter the number of people who watched show 3
1 Enter the average rating for show 3
The overall average rating for the show is 2.09
2 T3 1000 Enter the number of people who watched show 1
90.8 Enter the average rating for show 1
500 Enter the number of people who watched show 2
78.0 Enter the average rating for show 2
2000 Enter the number of people who watched show 3
67.9 Enter the average rating for show 3
The overall average rating for the show is 75.89
3 TC 5 500 Enter the number of people who watched show 1
4.5 Enter the average rating for show 1
255 Enter the number of people who watched show 2
2.5 Enter the average rating for show 2
3 Enter the number of people who watched show 3
5.5 Enter the average rating for show 3
The overall average rating for the show is 3.83
4 T1 400 Enter the number of people who watched show 1
9.8 Enter the average rating for show 1
500 Enter the number of people who watched show 2
9.6 Enter the average rating for show 2
100 Enter the number of people who watched show 3
5 Enter the average rating for show 3
The overall average rating for the show is 9.22
5 TC 7 58 Enter the number of people who watched show 1
6 Enter the average rating for show 1
55 Enter the number of people who watched show 2
2 Enter the average rating for show 2
253 Enter the number of people who watched show 3
2 Enter the average rating for show 3
The overall average rating for the show is 2.63
6 T2 200 Enter the number of people who watched show 1
5.8 Enter the average rating for show 1
100 Enter the number of people who watched show 2
4 Enter the average rating for show 2
300 Enter the number of people who watched show 3
SNo Name Input Output
9.1 Enter the average rating for show 3
The overall average rating for the show is 7.15
7 TC 6 1 Enter the number of people who watched show 1
5 Enter the average rating for show 1
1 Enter the number of people who watched show 2
5 Enter the average rating for show 2
1 Enter the number of people who watched show 3
5 Enter the average rating for show 3
The overall average rating for the show is 5.00
8 TC 8 8977 Enter the number of people who watched show 1
5 Enter the average rating for show 1
55 Enter the number of people who watched show 2
5 Enter the average rating for show 2
684 Enter the number of people who watched show 3
5 Enter the average rating for show 3
The overall average rating for the show is 5.00
Lucky Gifts
"Planet Kids Entertainment Fair" is back to delight kids and parents. The Fair will
have non-stop entertainment with an extravaganza of games, exciting rides, sports,
art & crafts, role-plays, inspiring competitions, prizes & gifts, and yummy food.
Few lucky attendees at the Fair will be given a pack of candies as a lucky gift and
the show coordinator has assigned you the task for choosing the number of
attendees who will receive the pack of candies. There are 'N' candies available and
you need to decide how many candies to place in each pack. Each pack must
contain the same number of candies. You should choose an
integer A between 1 and N, inclusive, and place exactly A candies into each pack.
You should make as many packs as possible but since you enjoy eating candies
very much, you eat the remaining candies.
Write a program that will calculate the pack size(A) so that you can eat as many
candies as possible. If multiple pack size will result in the same number of leftover
candies, then print the largest pack size.
Input Format:
The first and only line of input contains an integer N.
Output Format:
Output a single line that gives the pack size that will maximize the number of leftover
candies.
Refer sample input and output for formatting specifications.
Sample Input 1:
2
Sample Output 1:
2
Explanation:
There will be no leftover candies regardless of the size of the pack you choose. So
you choose the largest possible pack size 2.
Sample Input 2:
5
Sample Output 2:
3
Explanation:
There will be 2 leftover candies, if you choose 3 as the pack size.
Test Cases
Assign Groups
1 T3 10 6
2 T6 950 476
3 T1 2 2
4 T5 1000 501
5 T2 5 3
6 T8 18 10
7 T7 4 3
8 T4 50 26
Note:
Refer to problem specifications.
Input Format:
First line of the input is an integer N, the change to be given to Pranav.
Output Format:
Output should display the the smallest number of notes that will combine to give N.
Refer sample input and output for formatting specifications.
Sample Input 1:
1200
Sample Output1:
12
Sample Input 2:
242
Sample Output2:
7
Test Cases
Assign Groups
1 T7 2 1
2 T4 250 3
3 T8 5 1
4 T5 15 2
5 T1 1200 12
6 T3 500 5
7 T11 660 8
SNo Name Input Output
8 T6 100 1
9 T2 242 7
10 T9 10 1
11 T10 657 9
Talent Show
Mountain View Middle School is all set for organizing their elaborate talent show
event of the year, "Stars Onstage". It is a fun-filled event for the students to
showcase and build their confidence.
Of the total audience who had come for the show, 1/3 were boys, 3/6 were girls and
the rest of them were adults. If there were 'x' more girls than adults, how many
people were there in total? Help the School authorities to find the total people who
visited their show.
Input Format:
First line of the input is an integer 'x', which corresponds to the count of girls more
than adults.
Output Format:
Output the total number of people who had visited the talent show.
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output.]
Assign Groups
1 T1 50 Enter x
150 people were there in total
SNo Name Input Output
2 T3 100 Enter x
300 people were there in total
3 TC 8 5 Enter x
15 people were there in total
4 T7 90 Enter x
270 people were there in total
5 T5 120 Enter x
360 people were there in total
6 T4 30 Enter x
90 people were there in total
7 T2 70 Enter x
210 people were there in total
8 T6 12 Enter x
36 people were there in total
THREE IDIOTS
Ajay, Binoy and Chandru were very close friends at school. They were very good in Mathematics
and they were the pet students of Emily Mam. Their gang was known as 3-idiots. Ajay, Binoy and
Chandru live in the same locality.
A new student Dinesh joins their class and he wanted to be friends with them. He asked Binoy
about his house address. Binoy wanted to test Dinesh's mathematical skills. Binoy told Dinesh
that his house is at the midpoint of the line joining Ajay's house and Chandru's house. Dinesh
was puzzled. Can you help Dinesh out?
Given the coordinates of the 2 end points of a line (x1,y1) and (x2,y2), write a program to find
the midpoint of the line.
Input Format:
Input consists of 4 integers. The first integer corresponds to x1 . The second integer corresponds
to y1. The third and fouth integers correspond to x2 and y2 respectively.
Output Format:
Refer Sample Input and Output for exact formatting specifications.
[All floating point values are displayed correct to 1 decimal place]
Sample Input and Output:
[All text in bold corresponds to input and the rest corresponds to output]
X1
2
Y1
4
X2
10
Y2
15
Binoy's house is located at (6.0,9.5)
Test Cases
Assign Groups
1 T1 2 X1
4 Y1
10 X2
15 Y2
Binoy's house is located at (6.0,9.5)
2 T2 10 X1
20 Y1
45 X2
65 Y2
Binoy's house is located at (27.5,42.5)