s 4. Odd or even Step 3 : If number divisible by 2 then Print "Number is Even" Step 3.1 : else Print "Number is Odd" Step 4 : Stop 5. Greatest among three numbers Step 2 : Read values of a, b and c Step 3 : If a > b and a > c then Print "A is the biggest" Step 3.1 : else if b>c then Print "B is the biggest " Step 3.2 : else Print "C is the biggest" Step 4 : Stop 6. Simple Calculator Step 2 : Read operands a and b Step 3 : Display operation menu Step 4 : Read option Step 5 : If option = 1 then Calculate c = a + b Step 5.1 : else if option = 2 then Calculate c = a b Step 5.2 : else if option = 3 then Calculate c = a * b Step 5.3 : else if option = 4 then Calculate c = a / b Step 5.4 : else if option = 5 then Calculate c = a % b Step 5.5 : else Print "Invalid option" Step 6 : Print c Step 7 : Stop
7. Summation of N numbers Step 2 : Read n Step 3 : Initialize 0 to sum and 1 to i Step 4 : Add i to sum Step 5 : Increment i by 1 Step 6: Repeat steps 4 6 until i>n Step 7 : Print sum 8. Simple Interest and Compound Interest Step 2 : Read the values principal, rate and years Step 3 : Compute simple interest using the formulae: (principal rate years) / 100 Step 4 : Print simple interest Step 5 : Compute compound interest using the formulae: principal*pow(1+rate/100,years) principal Step 6 : Print compound interest Step 7: stop 9. Quotient and Remainder of two numbers Step 2 : Read the values of two numbers a and b Step 3 : Compute quotient by divide a by b Step 4: compute remainder by taking a mod b Step 5: display quotient and remainder Step 6: stop 10. Area and Circumference of a Circle Step 2 : Define constant pi = 3.14 Step 3 : Read the value of radius Step 4 : Calculate area using formulae: pi radius2 Step 5 : Calculate circumference using formulae: 2 pi radius Step 6 : Print area and circumference Step 7 : Stop 11. Fibonacci Series of terms as n
Step 3 : Initialize 0 to f1, 1 to f2 and 2 to i Step 4 : Print initial fibonacci terms f1, f2 Step 5 : Generate next term using the formula f3 = f1 + f2 Step 6 : Print f3 Step 7 : Increment i by 1 Step 8 : Assign f2 to f1 Step 9 : Assign f3 to f2 Step 10 : Repeat steps 5 9 until i<n Step 11 : Stop 12. Prime Number or Not Step 2 : Read the value of n Step 3 : Initialize i to 2 Step 4 : If n is divisible by i then Print Not Prime and Stop Step 5 : Increment i by 1 Step 6 : Repeat steps 4 and 5 until i>n/2 Step 7 : Print "Prime" 13. Factorial of a Number Step 3 : Initialize 1 to fact and number to i Step 4 : fact = fact * i Step 5 : Decrement i by 1 Step 6: Repeat steps 4 6 until i> 0 Step 7 : Print fact 14. Reverse the digits of a number Step 3 : Initialize 0 to reverse Step 5 : Compute reverse = reverse10 + lastdigit Step 8 : Print reverse 15. Sum of digits
Step 3 : Initialize sum=0 Step 5 : Compute sum=sum+ reverse Step 8 : Print the sum of digits 16. GCD of Numbers Step1: start Step 2: Read the values m and n Step 3: Check whether m is not equal to n. If it is not equal, then do the next step. Otherwise Go to step 7 Step 4: If m is greater than n then computer m=m-n Step 5: else if n is greater than n, then compute n=n-m Step 6: repeat step 3 Step 7: display the result m as the GCD of two number Step 8: stop 17. Palindrome or Not Step 3 : Initialize 0 to reverse Step 5 : Compute reverse = reverse10 + lastdigit Step 8 : If the given number is equal to the reverse then print the number is a palindrome. Otherwise, it is not a palindrome. 18. Roots of a Quadratic Equation Step 1: Read a,b,c Step 2: calculate the roots using the formula Root1 = -b +( d / 2*a) Root2 = -b ( d / 2*a) Where d=b 2-4ac Step 3: Display the roots Step 4: stop
19. Armstrong Number Step 3 : Initialize 0 to sum and number to num Step 5 : Cube the lastdigit and add it to sum Step 8 : If sum = number then Print Armstrong number Step 8.1 : else Print Not an Armstrong number C PROGRAMMING 20. Sort n numbers Step 2 : Read the value n Step 3: Read n numbers using array Step 4: Set i=0 to n-1 increment by 1 Step 5: set j=i+1 to n increment by 1 Step 6: If the value of i is greater than j then swap a[i] and a[j]. Step 7: Repeat step 5 & 6 Step 8: Repeat steps 4 to 7 Step 9: Display the result Step 10: stop 21. Minimum and maximum of a set of numbers Step 2 : Read the value n Step 3: Read n numbers using array Step 4: Assign min -> a[0] and max -> a[0] Step 5: Set i=1 to n increment by 1 Step 6: If min is greater than a[i] then assign min->a[i] and If max is smaller than a[i] then assign max=a[i]. Step 7: Repeat steps 5 & 6 Step 8: Display min and max Step 9: stop Step 2 : Read n 22. Sum of n numbers
Step 3 : Initialize 0 to sum and 1 to i Step 4 : Add i to sum Step 5 : Increment i by 1 Step 6: Repeat steps 4 6 until i>n Step 7 : Print sum 23. Matrix addition Step 2 : Read the value of the matrix A[2 2] Step 3 : Read the value of the matrix B[ 2 2] Step 4: set i-> 1 to 2 increment by 1 Step 5: set j=1 to 2 increment by 1 Step 6: Add the two matrix by S[i][j]=A[i][j]+B[i][j] Step 7: Repeat steps 4 to 6 Step 8: Display the resultant matrix S Step 9: stop 24. Roots of a quadratic equation Step 1: Read a,b,c Step 2: calculate the roots using the formula Root1 = -b +( d / 2*a) Root2 = -b ( d / 2*a) Where d=b 2-4ac Step 3: Display the roots Step 4: stop 25. Linear search Step 2: Read the value n Step 3: Read n elements using array Step 4: Read the search item search Step 5: Set i-> 1 to n increment by 1 Step 6: If search element is matched with the array element then display element is found and exit from the program Step 7: Otherwise, Repeat step 5 & 6 Step 8: If the search item is not matched with any array element then Display element is not found Step 9: Stop Step 1: start 26. Binary search
Step 2: Get N elements and store the elements in the array K in ascending order. Step 3:Get the element to be searched X. Step 4:Initialize LOW=1,HIGH=N; Step 5:Until LOW<= HIGH check whether X <K[MIDDLE] Step 6:if so HIGH=MIDDLE-1, Otherwise check whether X > K[MIDDLE]. Step 6:if so LOW=MIDDLE+1,Otherwise Display UNSUCCESSFUL SEARCH Step 7: Stop 27. Call by value : Step 2: Read x & y Step 3: Call the function swap and pass the value of x & y as arguments Step 4: Execute the function swap and interchange the value of x and y Step 5: Display the result Step 6: Stop 28. Call by Reference : Step 2: Read x & y Step 3: Call the function swap and pass the address of x & y as arguments Step 4: Execute the function swap and interchange the value of x and y Step 5: Display the result Step 6: Stop 29. Structures : Step 2: Declare the structure distance with feet and inch as arguments Step 3: Create the objects d1,d2 and sum for the structures Step 4: Read the input for the object d1 & d2 Step 5: Add the values of the objects d1 and d2 and store it in sum Step 6: Display the result of the object sum Step 7: Stop 30. File I/O : Step 2: Create a text file out.txt Step 3: Create a file pointer fp Step 4: Open a file out.txt in read mode Step 5: Get a character one by one from the input file and display it until the end of file is reached. Step 6: Stop