Algorithoms
Algorithoms
**
/ - quotient
% - remainder
**
Step 1 : Start
Step 2 : Read number "n"
Step 3 : rem = n%2 (Initialise remainder as rem)
Step 4 : If rem = 0, print even
Step 5 : Else print odd
Step 6 : End
Step 1 : Start
Step 2 : Read numbers "a","b"
Step 3 : c = a + b
Step 4 : Print "c"
Step 5 : End
example 5: Adding two numbers and print sum only if it is greater than 100
Step 1 : Start
Step 2 : Read numbers "a","b"
Step 3 : c = a + b
Step 4 : If c>100,print "c"
Step 5 : End
example 6 : Adding two numbers and print sum only if it is greater than 100 else
ask user to input again
Step 1 : Start
Step 2 : Read numbers "a","b"
Step 3 : c = a + b
Step 4 : If c>100,print "c"
Step 5 : Else print "Enter input again"
Step 6 : End
example 7 : Adding two numbers and print sum only if input is even
Step 1 : Start
Step 2 : Read numbers "a", "b"
Step 3 : c = a + b
Step 4 : rem1 = a%2, rem2 = b%2
Step 5 : if rem1,rem2 = 0, print "c"
Step 6 : End
Step 1 : Start
Step 2 : A,B,C,D,E are the 5 subjects
Step 3 : Read numbers 'A','B','C','D','E'
Step 3 : Total = A + B + C + D + E
Step 4 : Percentage = Total/5
Step 5 : if Percentage>=85 go to step 6 else go to step 7
Step 6 : Display A+
Step 7 : if 70<=Percentage<85 go to step 8 else go to step 9
Step 8 : display A
Step 9 : if 60<=Percentage<70 go to step 10
Step 10 : Display B
Step 11 : End
Step 1 : Start
Step 2 : no of units consumed is "u"
Step 3 : if u>=0 and u<=200 go to step 4, else go to step 5
Step 4 : display electricity bill is Rs 500
Step 5 : if u>=200 and u<=500 go to step 6 else go to step 7
Step 6 : display electricity bill is Rs 500+((u-200)*2)
Step 7 : if u>=500 and u<=700 go to step 8
Step 8 : display electricity bill is 500+((u-200)*4)
Step 9 : End
Step 1: Start
Step 2: Take two numbers A,B
Step 3: If A>B go to step 4 else go to step 5
Step 4: Display A,B
Step 5: Display B,A
Step 6: End
Step 1 : Start
Step 2 : take 3 number a,b,c
Step 3 : if a>b go to step 6 else go to step 5
Step 4 : if a>c go to step 8 else ngo to step 7
Step 5 : if b>c go to step 8 else go to step7
Step 6 : display a is greatest
Step 7 : display c is greatest
Step 8 : display b is greatest