Algorithm Practice Sums Guide
Algorithm Practice Sums Guide
Input the year, then check if it's divisible by 4 and not divisible by 100, unless it's also divisible by 400. If these conditions are met, print 'Leap Year'; otherwise, print 'Not a Leap Year' .
Input the number and check its value: if it's greater than zero, print 'Positive'; if less than zero, print 'Negative'; otherwise, print 'Zero' .
To convert Celsius to Fahrenheit, use the formula: Fahrenheit = (Celsius × 9/5) + 32. Input the temperature in Celsius, apply the formula, and display the result .
Input the age of the person. If the age is 18 or older, print 'Eligible to vote'; otherwise, print 'Not eligible' .
Input the number, then check if the remainder of the number when divided by 2 (n % 2) is zero; if so, print 'Even', otherwise print 'Odd' .
Input the number of units consumed and the rate per unit. Calculate the total bill using: Total Bill = units × rate per unit, and display the result .
Input the principal amount, rate of interest, and time period. Calculate the simple interest using: Simple Interest = (Principal × Rate × Time) / 100, and then display the result .
Input the rectangle's length and breadth. Calculate the area using the formula: Area = length × breadth, and the perimeter using: Perimeter = 2 × (length + breadth).
To calculate the average of five subject marks, input the marks of each subject and store them in variables a, b, c, d, e. Then, compute the average as avg = (a + b + c + d + e) / 5. Finally, display the average value .
Input the percentage and apply the following conditions: if percentage is 90 or above, assign 'Grade A'; if 75 or above but below 90, assign 'Grade B'; if 50 or above but below 75, assign 'Grade C'; otherwise, assign 'Grade D' .