100% found this document useful (1 vote)
6K views16 pages

1 - Io Statements

Nikhil, the founder of "Pine Tree" event management company, wants to develop an online event management system called Amphi. He needs help writing code for various functions of the system, including: 1. Displaying a welcome message to users. 2. Displaying a customized welcome message with the user's name. 3. Getting input for the number of events at a trade fair and displaying it. 4. Getting various details about an event like name, type, attendees, costs, and displaying the input. 5. Calculating total event expenses and the percentage of different cost categories. 6. Calculating attendee numbers on different days of a trade fair based

Uploaded by

raman yarramilli
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
100% found this document useful (1 vote)
6K views16 pages

1 - Io Statements

Nikhil, the founder of "Pine Tree" event management company, wants to develop an online event management system called Amphi. He needs help writing code for various functions of the system, including: 1. Displaying a welcome message to users. 2. Displaying a customized welcome message with the user's name. 3. Getting input for the number of events at a trade fair and displaying it. 4. Getting various details about an event like name, type, attendees, costs, and displaying the input. 5. Calculating total event expenses and the percentage of different cost categories. 6. Calculating attendee numbers on different days of a trade fair based

Uploaded by

raman yarramilli
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/ 16

I/O Statements, Operators and Expressions

1.Welcome Message
"Pine Tree" is a recently launched startup Event Management company. The
company gained a good reputation within a short span because of its highly reliable
service delivery.
 
Nikhil, the founder of this company wished to take the company’s services to the
next step and decided to design an Event Management System that would let its
Customers plan and host events seamlessly via an online platform. As a part of this
requirement, Nikhil wanted to write a piece of code for his company’s Amphi Event
Management System that will welcome all the Customers who are using it. Help
Nikhil on the task.

Output Format:
Output should display "Welcome to Amphi Event Management System".
Refer sample output for formatting specifications.

Sample Output:
Welcome to Amphi Event Management System

2.Customized Welcome Message


 

Nikhil, the founder of “Pine Tree” company wished to design an Event Management
System that would let its Customers plan and host events seamlessly via an online
platform.
 
As a part of this requirement, Nikhil wanted to write a piece of code for his
company’s Amphi Event Management System that will display customized welcome
messages by taking Customers’ name as input. Help Nikhil on the task.
 
Input Format:
First line of the input is a string that corresponds to a Customer’s name. Assume that
the maximum length of the string is 50.

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.]

Sample Input and Output:


Enter your name
Beena
Hello Beena ! Welcome to Amphi Event Management System

Program:

#include <stdio.h>

void main()

char customer_name[50];

printf("Enter your name\n");

scanf("%s",&customer_name);

printf(" Hello %s ! Welcome to Amphi Event Management


System",customer_name);

3.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.]

Sample Input and Output:


Enter the number of events hosted in Codissia
50
Number of events hosted in Codissia is 50
#include <stdio.h>

void main() {

int a;

printf("Enter the number of events hosted in Codissia");

scanf("%d",&a);

printf("Number of events hosted in Codissia is %d",a);

4.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

// Online C compiler to run C program online

#include <stdio.h>

#include<string.h>

#include<stdlib.h>

void main()

char str1[50],str2[50];

int p;

double l;

char y;

printf("Enter the name of the event\n");

gets(str1);

printf("\nEnter the type of the event\n");

gets(str2);

fflush(stdin);
printf("\nEnter the number of people expected\n");

scanf("%d",&p);

printf("\nIs it a paid entry? (Type Y or N)\n");

scanf("%s",&y);

printf("\nEnter the projected expenses (in lakhs) for this event\n");

scanf("%lf",&l);

printf("Event Name:%s\nEvent Type:%s\n",str1,str2);

printf("Expected Count:%d \nPaid Entry:%c\nProjected Expense:%lf\n",p,y,l);

5.Total Expenses for the Event


 
The prime functionality of an Event Management System is budgeting. An Event
Management System should estimate the total expenses incurred by an event and
the percentage rate of each of the expenses involved in planning and executing an
event. Nikhil, the founder of "Pine Tree" wanted to include this functionality in his
company’s Amphi Event Management System and requested your help in writing a
program for the same.
 
The program should get the branding expenses, travel expenses, food expenses and
logistics expenses as input from the user and calculate the total expenses for an
event and the percentage rate of each of these expenses.
 
Input Format:
First input is a double value that corresponds to the branding expenses.
Second input is a double value that corresponds to the travel expenses.
Third input is a double value that corresponds to the food expenses.
Fourth input is a double value that corresponds to the logistics expenses.
 
Output Format:
First line of the output should display the double value that corresponds to the total
expenses for the Event.
Next four lines should display the percentage rate of each of the expenses.
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 branding expenses
20000
Enter travel expenses
40000
Enter food expenses
15000
Enter logistics expenses
25000
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%
 

6.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.]

Sample Input and Output:


Enter the total number of people
10500
Number of attendees on day 1 : 3000
Number of attendees on day 2 : 6000
Number of attendees on day 3 : 1500

7.Ticket sold for Charity Event


 
HelpIndia, a famous
NGO has been selective in identifying events to raise funds for charity. Suzanne is a
volunteer from the NGO who was selling tickets to the public for the charity event.
She sold 'X' more adult tickets than children tickets and she sold twice as many
senior tickets as children tickets. Assume that an adult ticket costs $5, children ticket
costs $2 and senior ticket costs $3.
Suzanne made 'Y' dollars from ticket sales. Find the number of adult tickets, children
tickets and senior tickets.
 
Input Format:
First input is an integer value X that corresponds to the number of adult tickets more
than children tickets.
Second input is an integer value Y that corresponds to the money in dollars made by
Suzanne from ticket sales.
 
Output Format:
First line of the output should display the number of children tickets sold.
Second line of the output should display the number of adult tickets sold.
Third line of the output should display the number of senior tickets sold.
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 value of X
10
Enter the value of Y
700
Number of children tickets sold : 50
Number of adult tickets sold : 60
Number of senior tickets sold : 100

8.Tile Game
 

In connection to the National Mathematics Day celebration, the Regional


Mathematical Scholars Society had arranged for a Mathematics Challenge Event
where school kids participated in large number. Many interesting math games were
conducted, one such game that attracted most kids was the tile game where the kids
were given 'n' square tiles of the same size and were asked to form the largest
possible square using those tiles.
 
Help the kids by writing a program to find the area of the largest possible square that
can be formed, given the side of a square tile (in cms) and the number of square tiles
available.
 
Input Format:
First line of the input is an integer that corresponds to the side of a square tile (in
cms).
Second line of the input is an integer that corresponds to the number of square tiles
available.
 
Output Format:
Output should display the area of the largest possible square that can be formed (in
square cms) with the available tiles.
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 side in cm of a square tile
5
Enter the number of square tiles available
8
Area of the largest possible square is 100sqcm

9.Wisconsin State Fair


 
Wisconsin State Fair is one of the largest midsummer celebrations in the Midwest
Allis, showcasing the agriculture skills and prowess of the state. The Event
organizers hired few part-time employees to work at the fair and the agreed salary
paid to them are as given below:
 
Weekdays --- 80 / hour
Weekends --- 50 / hour
 
Justin is a part-time employee working at the fair. Number of hours Justin has
worked in the weekdays is 10 more than the number of hours he had worked during
weekends. If the total salary paid to him in this month is known, write a program to
estimate the number of hours he had worked during weekdays and the number of
hours he had worked during weekends.
 
Input Format:
First line of the input is a double value that corresponds to the total salary paid to
Justin.

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.]
Sample Input and Output:
Enter the total salary paid
2750
Number of weekday hours is 25
Number of weekend hours is 15

10.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.]
Sample Input and Output:
Enter the number of people who watched show 1
400
Enter the average rating for show 1
9.8
Enter the number of people who watched show 2
500
Enter the average rating for show 2
9.6
Enter the number of people who watched show 3
100
Enter the average rating for show 3
5
The overall average rating for the show is 9.22

11.Birthday Challenge
 

Louis was celebrating his 10th Birthday and his parents wished to make his birthday
more special by throwing a surprise bash, inviting all their friends, relatives and
neighbors. The little mathematics geek Louis has another surprise waiting for him
when he had to cut his favorite Choco vanilla cake. The cake is a rectangular cake
and it consists of m×n (1≤m, n≤1000) squares. His friends now called him out for a
challenge.
 
The challenge is that, Louis has to break the cake up into 1×1 pieces (individual
squares) and find what is the minimum number of times that he breaks the choco
vanilla cake, or pieces thereof, in order to achieve this?
 
Note that he cannot stack pieces of the cake and break them, because the choco
vanilla cake is thick. As an example, a 2×2 cake requires 3 breaks. First he can
break it in half, then break each of the halves in half. He cannot break it in half, stack
the two 1×2 pieces, and then use only one more break to achieve his goal.
 
Input Format:
First line of the input consists of an integer, the dimensions m of the choco vanilla
cake.
Second line of the input consists of an integer, the dimensions n of the choco vanilla
cake.

Output Format:
Output the minimum number of times that he breaks the choco vanilla cake
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output.]

Sample Input and Output 1:


Enter m
1
Enter n
2
Minimum number of times is 1

Sample Input and Output 2:


Enter m
2
Enter n
2
Minimum number of times is 3

12.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 maximum number of candies per pack that
can be made with 'N' candies so that you can also maximise the number of  candies
that you can eat.
 
Input Format:
The first and only line of input contains an integer N.
 
Output Format:
Output a single line that gives the maximum number of candy packs that can be
made with 'N' candies.
Refer sample input and output for formatting specifications.

Sample Input 1:
2

Sample Output 1:
2

Sample Input 2:
5

Sample Output 2:
3

13.Pranav and Change


 

Pranav, an enthusiastic kid visited the "Fun Fair 2017" along with his family. His
father wanted him to purchase entry tickets from the counter for his family members.
Being a little kid, he is just learning to understand about units of money. Pranav has
paid some amount of money for the tickets but he wants your help to give him back
the change of Rs. N using minimum number of rupee notes.
 
Consider a currency system in which there are notes of seven denominations,
namely, Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 50, Rs. 100. If the change given to Pranav
Rs. N is input, write a program to computer smallest number of notes that will
combine to give Rs. N.

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

14.Food Festival at HillTown


HillTown Inn is planning to organize a Food Festival bringing together at one place, a
wide variety of cuisines from across the world on account of Christmas. The Hotel
Management has rented out a square hall of an indoor Auditorium for this
extravaganza. The side of the square hall is y  inches in which a large square table
is placed for the display of the most popular and celebrated food items. The side of
the square table is x  inches, such that x<y.
 
The Management wanted to fill the remaining floor area with a decorative carpet. To
get this done, they needed to know the floor area to be filled with the carpet. Write a
program to help the Management find the area of the region located outside the
square table, but inside the square hall.
 
Input Format:
First line of the input is an integer y, the side of the square hall.
Second line of the input is an integer x, the side of the square table placed for
display.
 
Output Format:
Output should display the area of the floor that is to be decorated with the carpet.
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output.]

Sample Input and Output 1:


Enter the side of the square hall
7
Enter the side of the square table placed for display
3
Area to be decorated is 40
Sample Input and Output 2:
Enter the side of the square hall
5
Enter the side of the square table placed for display
2
Area to be decorated is 21

15.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.]

Sample Input and Output1:


Enter x
50
150 people were there in total

Sample Input and Output2:


Enter x
70
210 people were there in total

You might also like