Monday, September 30, 2019

                                    E-BOX                                                               

                             BASICS OF C PROGRAMMING                                            

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

PROGRAM - 1 : 



PROBLEM

S1P1-WELCOME MESSAGE

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


SOLUTION :



Sunday, September 15, 2019

                                                                        E-BOX    

                                               BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  Code Analysis

PROGRAM : 15

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

Enter x1

2

Enter y1

4

Enter x2

10

Enter y2

15

Binoy's house is located at (6.0 , 9.5)



SOLUTION :





Saturday, September 14, 2019

                                                E-BOX    

                                            BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  Code Analysis

PROGRAM : 14 

                                                           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 C 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)



SOLUTION:


GIVEN INPUT :

10
20
45
65

EXPECTED OUTPUT :

X1
Y1
X2
Y2
Binoy's house is located at (27.5,42.5)

Friday, September 13, 2019

                                                 E-BOX    

                                             BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  Code Analysis

PROGRAM : 13

                                                            FOUR SEASONERS

Dinesh also joined the group of 3 idiots and now their group is called Four Seasoners. Meanwhile, Binoy has moved to a new house in the same locality. Now the houses of Ajay, Binoy and Chandru are in the located in the shape of a triangle. Dinesh also has moved to a house in the same locality. When Ajay asked Dinesh about the location of his house , Dinesh said that his house is equidistant from the houses of the other 3. Though Ajay was good in Mathematics, he was puzzled. Can you please help Ajay out?


Given the 3 vertices {(x1,y1), (x2,y2) and (x3,y3)} of a triangle, write a C program to determine the point which is equidistant from all the 3 vertices.


Input Format:

Input consists of 6 integers. The first integer corresponds to x1 . The second integer corresponds to y1. The third and fouth integers correspond to x2 and y2 respectively.

The fifth and sixth integers correspond to x3 and y3 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

X3

5

Y3

8

Dinesh's house is located at (5.7,9.0)



SOLUTION:


GIVEN INPUT :

2
4
10
15
5
8

EXPECTED OUTPUT :

X1
Y1
X2
Y2
X3
Y3
Dinesh's house is located at (5.7,9.0)

Thursday, September 12, 2019

                                                E-BOX    

                                            BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  Code Analysis

PROGRAM :  12 

                                                     Pogo Stick Jump

Raju lives in a colony. On his 9th birthday, his father gifts him a Pogo Stick, Raju is so excited to play with the pogo stick. The pogo stick moves one unit per jump. He wanders around his house jumping with pogo sticks. He likes to show the pogo stick to his friends and decides to go using the pogo sticks. Write a program to find the number of jumps needed to reach his friend's house. Assume that Raju's house is in the location (3,4).

Input and Output Format:
Input consists of two integers x,y. The x and y corresponds to x and y coordinates of his friend's house.
Output is an integer - the number of jumps he needs to reach his friend's house.

Sample Input and Output:
Enter the X and Y coordinate of the friend's house
5
6
Raju needs 3 jumps


SOLUTION :

Your Submission is correct.
#include<stdio.h>
#include<math.h>
int main()
{
int x,y,a=3,b=4;
float e;
printf("\nEnter the X and Y coordinate of friend's house");
scanf("%d%d",&x,&y);
e=sqrt(((x-a)*(x-a))+((y-b)*(y-b)));
e=ceil(e);
printf("\nRaju needs %.0f jumps",e);
return 0;
}

Wednesday, September 11, 2019

                                                E-BOX    

                                             BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  Code Analysis

PROGRAM : 11

                                                               INTERCEPTS

Emily is a very popular Maths Teacher in School. She retires from her service today. Her 7th class students like her very much and they wanted to give her a grand farewell at school. The school HeadMistress is a very strict person and she didn't give permission for them to conduct the farewell in the school premises. The students decided to conduct the farewell at Emily Mam's house itself.
 

They know the street in which Emily mam lives. The student leader asked Emily Mam to tell her house number. Emily Mam's last class was on Equation for a straight line. She said that a straight line can be represented by the equation y=mx+c and you know how to find the x-intercept and y-intercept of the line and my house number is the sum of the x-intercept and y-intercept of the line.
 

The students were puzzled. Can you help the students find the house number of Emily Mam?

Given the values of m and c of the line equation y=mx+c, write a C program to find the sum of x-intercept and y-intercept.

Input Format:

Input consists of 2 integers. The first integer corresponds to m and the second integer corresponds to c.


Output Format:

Refer Sample Input and Output for exact formatting specifications.

[Assume that the inputs are such that the intercept values are always integers]

Sample Input and Output:

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

Value of m:

5

Value of c:

10

The line equation is y=5x+10

x intercept is -2

y intercept is 10

The house number is 8



SOLUTION :


Your Submission is correct.

#include<stdio.h>
int main()
{
int m,c,x,y;
printf("Value of m:\n");
scanf("%d",&m);
printf("Value of c:\n");
scanf("%d",&c);
printf("The line equation is y=%dx+%d\n",m,c);
x=-c/m;
printf("x intercept is %d\n",x);
y=c;
printf("y intercept is %d\n",y);
printf("The house number is %d",x+y);
return 0;
}

Tuesday, September 10, 2019

                                             E-BOX    

                                        BASICS OF C PROGRAMMING   

I/O Statements,Operators And Expressions :-  Code Analysis

PROGRAM : 10

                                                      FENCING THE GROUND

The college ground is rectangular in shape. The Management decides to build a fence around the ground. In order to help the construction workers to build a straight fence, they planned to place a thick rope around the ground. They wanted to buy only the exact length of the rope that is needed. They also wanted to cover the entire ground with a thick carpet during rainy season. They wanted to buy only the exact quantity of carpet that is needed. They requested your help.


Help them by writing a C program to find the exact length of the rope and the exact quantity of carper that is required?


Input Format:

Input consists of 2 integers. The first integer corresponds to the length of the ground and the second integer corresponds to the breadth of the ground.


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]

Length:

50

Width:

20

Required length is 140m

Required quantity of carpet is 1000sqm



SOLUTION :


Your Submission is correct.

#include<stdio.h>
int main()
{
int i,j,k,l;
printf("Length:\n");
scanf("%d",&i);
printf("Width:\n");
scanf("%d",&j);
l = 2*(i+j);
printf("Required length is %dm\n",l);
k = i * j;
printf("Required quantity of carpet is %dsqm",k);
return 0;
}

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

https://amzn.to/2LAmadv