Monday, 15 January 2018

IO 6

QUESTION DESCRIPTION

Write a program by using all relational operators. 

Input and Output Format:

Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input and the rest corresponds to output.

TEST CASE 1

INPUT

30 40

OUTPUT

Value of 30>40 is:0 
Value of 30>=40 is:0 
Value of 30<40 is:1 
Value of 30<=40 is:1

EXPLANATION :

The code requires you to accept 2 numbers from the user and check them for ">" , "<" , "<=" , ">=" and print '1' or '0' for "true" or "false" respectively according to the output format.


ALGORITHM :

This is a simple algorithm, as the result of the conditional statements (>,<,>=,<=) is an integer ("0" for "false" and "1" for "true"), we directly print the result of the conditional statements.

Steps :
  • Accept the values of first and the second number
  • Print the results of conditional statements in this order :
    • Greater than
    • Greater than equal to
    • Less than
    • Less than equal to

Remember the spacing in the output and the end of line


SOLUTION :  (Please use this as reference only)






Thursday, 28 December 2017

We Will Be Back Soon....




Yes, you read it right, we will be back soon with more content, more questions, and even more answers.


First of all we would like to thank you all who have been to the blog and made it what it is right now.

Secondly we would request you to ask any question related to competitive programming or any queries you have in the comments section of this or any other post you feel like.

Thirdly if you don't find any question from the elab platform here and want it to be added all you need to do is this :

  1. Take a screenshot of the question and the sample test cases
  2. Upload it to Google Drive
  3. Send the link in the comments section of any post
The question will be attended to soon and an answer will be uploaded to the blog ASAP.

Finally we would like to thank you again for making 2017 a great year .

Wishing you a Happy New Year 2018

programmers@wttech

Saturday, 29 July 2017

Radius of a Circle

QUESTION DESCRIPTION

Madhan is handling mathematics to 8th grade. He taught area and perimeter of geometric shapes to his students. He thought to give a test based on triangle and circles.The task is to calculate radius of the circle that is inscribed in triangle given the three sides of the triangle. He has set 20 questions and he is tired of preparing answer keys.Write a program to find the radius of the circle inscribed in a triangle.

Input and Output Format :
Input consists of three integers a, b and c. The three integer
corresponds to three sides of a triangle.

TEST CASE 1


INPUT

3 4 5

OUTPUT

The radius of the circle is=1.00


EXPLANATION :

The code requires you to output the radius of a circle inscribed inside a triangle.
The input given is the three sides of the triangle and the output required is the radius of the circle that is inscribed inside the triangle in the specified format.

There are two basic geometric formula that can be used to get the desired result :
> r^2=(s-a)*(s-b)*(s-c)/s
> where s=(a+b+c)/2

The other method is  another format of the same formula that has been used above :

> r=((a+b-c)*(a+c-b)*(b+c-a))/2

ALGORITHM :
  • Accept the inputs in the program (int a,b,c)
  • Using either of the formulas calculate the value of the radius 
    • To calculate the square root of the equation the sqrt function is used, the header <math.h> needs to be imported to use the sqrt function.
  •  Print the radius with the desired tag "The radius of the circle is="

SOLUTION : (Please use this as reference only)

CODE