Skip to content

Conversion (Fahrenheit to Celsius) #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions Conversion (Fahrenheit to Celsius).py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Code Contributed by Abhishek Sharma, 2021, @abhisheks008
# Platform : Hackerblocks
# Launchpad Pitampura 16 Feb 2020
# Problem Name : Conversion (Fahrenheit to Celsius)
# Difficulty : Medium
# Max points : 100


# Problem Statement :

# Take the following as input.

# Minimum Fahrenheit value
# Maximum Fahrenheit value
# Step

# Print as output the Celsius conversions. Use the formula C = (5/9)(F – 32) E.g. for an input of 0, 100 and 20 the output is
# 0 -17
# 20 -6
# 40 4
# 60 15
# 80 26
# 100 37

# Input Format
# The first line of the input contains an integer denoting the Minimum Fahrenheit value. The second line of the input contains an integer denoting the Maximum Fahrenheit value. The third line of the input contains an integer denoting the Step.

# Constraints
# 0 < Min < 100 Min < Max < 500 0 < Step

# # Output Format
# Print Fahrenheit and Celsius values separated by a tab. Each step should be printed in a new line.

# Sample Input
# 0
# 100
# 20
# Sample Output
# 0 -17
# 20 -6
# 40 4
# 60 15
# 80 26
# 100 37

# Explanation
# First number in every output line is fahrenheit, second number is celsius. The two numbers are separated by a tab.

# Here's the code for the problem in Python 3

lower = int(input())
high = int(input())
gap = int(input())
for i in range (lower, high+1, gap):
print (i, end = " ")
cel = int(((i - 32)*5)/9)
print (cel)
print ()

# Status : All test cases passed and 100 out of 100
# Code contributed by Abhishek Sharma, 2021 @abhisheks008