We are discussing temperature for flowchart and algorithms in C Java and PHP. First I will discuss the flowchart. It is the most important thing for any programming language. Temperature conversion rules use solve celsius, kelvin, and Fahrenheit scale. According to law Fahrenheit scales freezing and boiling point which is water 32°F and 212°F respectively. And, according to the celsius scale freezing and boiling point 0°C and 100°C respectively. 

Firstly, I will explain the temperature conversion formula. Which is a formula, c/5=(F-32)/9=(K-273)/5 

According to the Lord Kelvin resource paper from knowing the world. It is the international scale that changes the conversion to another scale.  

How can I use algorithms and flowcharts to convert a number from °Celsius to °Fahrenheit and a number from kg to pounds?

°Celsius to °Fahrenheit: Celsius to Fahrenheit our need c/5=(F-32) this formula. We are applying the Algebra formula. If it has a c value then calculate and find out °Fahrenheit scale value.

Temperature conversion calculation

Algorithms: 

Step 1 : Start

Step 2 : variable decoration 

Step 3 : Input function scanf use

Step 4 : Use F=(9*c)/5+32

Step 4 : Print the temperature 

Step 5 : End

Flowchart:

Temperature conversion flowchart

KG to Pounds Convert:

KG means k=kilo G=gram, you have to be about a unit of kg to pound. It should be an international unit. 1kg is 2.205  pound,it’s punud unit. We solve kg to pound doing multiplication 2.204 and get the result.

 

For C code fahrenheit

				
					

#include

Int main()

{

Int c,f;

prinf(“Enter the value :”);

scanf(“%d”,&c);

// Fahrenheit scale formula

f=(9*c/5)+32;

printf(“Result is %d”,f);

Return 0; 

}

				
			

For PHP code fahrenheit scale result print. 

				
					<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=	, initial-scale=1.0">
	<title>Document</title>
</head>
<body>
	<form action="">
		<div class="container">	
			<div class="row">
				<div class="col-xl-12">	
					<form name="tempConvert" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?>">

						<div class="form-control">
							<div>
								<h2>Enter value to convert</h2>
								<div class="input-group"><input type="text" class="form-control-lg" name="input-temp" id="input-temp"></div>
							</div>

							
							<select class="form-select" name="con-fa-ce" id="con-fa-ce">
								<option selected>Open this select menu</option>
								<option value="celsius">celsius</option>
								<option value="sclae-fahrenheit">Sclae Fahrenheit</option>
							</select>
						</div>
						<div>
							<div><input type="submit" name="btn" id="btn" value="Convert"></div>
							<div><input type="reset" name="btnReset" id="btnReset" value="Reset"></div>
						</div>
					</div>

				</form>

				<?php


				$input-temp = $_POST['input-temp'];
				$con-fa-ce = $_POST['con-fa-ce'];
				function tempConvert($input-temp, $con-fa-ce){
				if($con-fa-ce == "sclae-fahrenheit"){
				$conversion-result = ((9/5)*$input-temp) +(32);
			}
			else if ($con-fa-ce == "celsius"){
			$conversion-result = ($input-temp - 32) * (9/5);
		}
		return $conversion-result;
		echo "Temperature was $input-temp . Result is temperature $conversion-result .";
	}
	?>
</div>	
</div>	
</div>
</form>


<?php


$input-temp = $_POST['input-temp'];
$con-fa-ce = $_POST['con-fa-ce'];
function tempConvert($input-temp, $con-fa-ce){
if($con-fa-ce == "sclae-fahrenheit"){
$sclae-fahrenheit = ((9/5)*$input-temp) +(32);
}
else {
$sclae-fahrenheit = ($input-temp - 32) * (9/5);
}
return $sclae-fahrenheit;
echo"  The new temperature is $sclae-fahrenheit.";
}
?>
</body>
</html>
				
			

Java Code Fahrenheit scale

				
					import java.util.Scanner;

public class Exercise1 {

    public static void main(String[] Strings) {

        Scanner input = new Scanner(System.in);

        System.out.print("Input fahrenheit  ");

        double fahrenheit_scale = input.nextDouble();

        double  fahrenheit_scale =(( 9*c/5)) + 32);

        System.out.println(fahrenheit_scale + " is fahrenheit result ");

    }

}
				
			

Leave a Reply

Your email address will not be published. Required fields are marked *