Do the following on how to create algorithm:
1.) Create an algorithm to check whether the grade is passed of fail
2.) Problem3: An algorithm to find the largest number of any any three numbers
3.) Create an algorithm to check whether a number is positive or negative
pasahan na po bukas
Answers & Comments
Explanation:
What is the algorithm for finding the greatest of three numbers?
The Algorithm for finding the greatest of three numbers :-
Step 1 : Start the program .
Step 2 : Declare variable a, b, c, largestValue.
Step 3 : If a > b go to step 4 Otherwise go to step 5
Step 4. If a > c SET largestValue = a Otherwise largestValue = c
Step 5 : If b > c SET largestValue = b Otherwise largestValue = c
Step 6 : End.
1.Implementation of the Algorithm using Java :
2.package conditionalStatements;
import java.util.Scanner;
3.
4.public class LargestValue{
5.
6.Public static void main(String [] args){
7.
8.Scanner sc = new Scanner(System.in);
9.
10.int a,b,c,largestValue;
11.
12.System.out.print("a = ");
13.a = sc.nextInt();
14.
15.System.out.print("b = ");
16.b = sc.nextInt();
17.
18.System.out.print("c = ");
19.c = sc.nextInt();
20.
21.if(a>b){
22.if(a>c){
23. largestValue = a;
24. }else{
25. largestValue = c;
26. }
27.}else{
28. if(b>c){
29. largestValue = b;
30. }else{
31. largestValue = c;
32 }
33.}
34.System.out.println("Largest among three numbers is = "+largestValue);
35. }
36.}
yan po sagot Sana po makatulong
pa brainliest nalang po