Algorithm and Flowchart To Convert A Number From °celsius To °fahrenheit

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

algorithm and flowchart to convert a

number from °Celsius to °Fahrenheit


• Algorithm
Step1 Start
Step2 Read the input of temperature in Celsius
(say C)
Step3 F=(9*C)/5+32
Step4 Print temperature in fahrenheit is F
Step5 Stop
Flowchart
//C program to convert Celsius to Fahrenheit

•#include <stdio.h>

•int main()
•{
• float celsius, fahrenheit;

• printf("Please Enter temperature in Celsius: \n");
• scanf("%f", &celsius);

• // Convert the temperature from celsius to fahrenheit
• fahrenheit = ((celsius * 9)/5) + 32;
• // fahrenheit = ((9/5) * celsius) + 32;
• // fahrenheit = ((1.8 * celsius) + 32;

• printf("\n %f Celsius = %f Fahrenheit", celsius, fahrenheit);

• return 0;
•}

An algorithm to find the root of quadratic
equation.
1. Start
2. Enter the value of a, b and c.
3. Calculate determinant as D= b2-4ac
4. If (D> 0) then continue else ‘GOTO Step 9
5. Calculate root1= -b + √D/2a
6. Calculate root2= -b – √D/2a
7. Print value of root1 and root2 these are Real and different
8. GOTO END
9. If (D==0) then continue else GOTO Step 13
10. Calculate root1 = root2 = -b/2*a
11. Print value of root1 and root2 the roots are real and equal.
12. GOTO END
13. Calculate RealPart = -b/2a
14. 14.Calculate imaginaryPart = √(-D)/2a
15. Print value of root1= RealPart + i imaginaryPart
16. Print value of root2= RealPart – i imaginaryPart the roots are complex and
different
17. 17.END
Fibonacci Series Algorithm:

1. Start
2. Declare variables i, a,b , show
3. Initialize the variables, a=0, b=1, and show =0
4. Enter the number of terms of Fibonacci series to be printed
5. Print First two terms of series
6. Use loop for the following steps
-> show=a+b
-> a=b
-> b=show
-> increase value of i each time by 1
-> print the value of show
7. End
Source code

You might also like