Thursday, October 17, 2019

                                                                          E-BOX                                                               

                               BASICS OF C PROGRAMMING                                            

I/O Statements,Operators And Expressions :-  i-Assess

PROGRAM -2 :

PROBLEM

CHANGE POSITION

Change Position

The room that Patrick and Johnny were staying was very big. They felt lazy to walk inside the room from the bed's location to another location. So they wanted to change the position of the bed. The shape of the room is a Square. They decided to place the bed at the centre of the room so that their walking distance would be minimised. Can you please help them in placing the bed at the centre?

                                                                                       

Given the coordinates of the left bottom vertex of the square room and the length of the side, you need to write a program to determine the coordinates of the centre of the room.

[Assumption --- Length of the side is always even]
 

Input Format:

Input consists of 3 integers. The first integer corresponds to the x-coordinate of the left bottom vertex. The second integer corresponds to the y-coordinate of the left bottom vertex. The third integer corresponds to the length of the square.

Output Format:

Refer Sample Input and Output for exact formatting specifications.
 

Sample Input and Output:

[All text in bold corresponds to input and the rest corresponds to output]

Enter the x-coordinate of the left bottom vertex

10

Enter the y-coordinate of the left bottom vertex

30

Enter the length of a side

16

The centre of the room is at (18,38)


SOLUTION : 



Wednesday, October 16, 2019

                                                                             E-BOX                                                               

                              BASICS OF C PROGRAMMING                                            

I/O Statements,Operators And Expressions :-  i-Assess

PROGRAM - 1 :  

PROBLEM

CALCULATING GAIN PERCENTAGE

Calculating Gain Percentage

Vikram buys an old scooter for Rs. A and spends Rs. B on its repairs. If he sells the scooter for Rs. C , what is his gain %?

Write a program to compute the gain %.

 

Input Format:

The first input is an integer which corresponds to A. The second input is an integer which corresponds to B. The third input is a float which corresponds to gain %.

Output Format:

Refer sample input and output for formatting specifications.

The float values are displayed correct to 2 decimal places.

Sample Input and Output:

[All text in bold corresponds to input and the rest corresponds to output]


Price of old scooter:

4700

Repair amount:

800

Selling price:

5800

Gain percentage is 5.45

 SOLUTION :




Tuesday, October 15, 2019

                                        E-BOX    

                                   BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  I - Design


PROGRAM -15 :


PROBLEM

S1P15-TALENT SHOW

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

 PROBLEM

S1P15-TALENT SHOW

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


SOLUTION :



Monday, October 14, 2019

                                      E-BOX    

                                 BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  I - Design

PROGRAM -14 :

 PROBLEM

S1P14-FOOD FESTIVAL AT HILLTOWN

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



SOLUTION :

Sunday, October 13, 2019

                                     E-BOX    

                              BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  I - Design

PROGRAM -13

PROBLEM

S1P13-PRANAV AND CHANGE

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 compute 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


Problem Requirements:

C

KeywordMin CountMax Count
do00
KeywordMin CountMax Count
while ....00


SOLUTION :




Saturday, October 12, 2019

                                 E-BOX    

                           BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  I - Design

PROGRAM -12

PROBLEM

S1P12-LUCKY GIFTS

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.


SOLUTION :



Friday, October 11, 2019

                                    E-BOX    

                                 BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  I - Design

PROGRAM -11 :

 PROBLEM

S1P11-BIRTHDAY CHALLENGE

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 therefore, 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 of the choco vanilla cake.
Second line of the input consists of an integer, the dimensions 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


SOLUTION : 



Thursday, October 10, 2019

                                      E-BOX    

                                   BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  i - Design

PROGRAM - 10 :    

PROBLEM

S1P10-WONDERWORKS MAGIC SHOW

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


SOLUTION :




Wednesday, October 9, 2019

                                  E-BOX    

                            BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  I - Design

PROGRAM - 9:   

PROBLEM

S1P9-WISCONSIN STATE FAIR

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


SOLUTION : 



                                                 E-BOX                                                     BASICS OF C PROGRAMMING       i -...

https://amzn.to/2LAmadv