0% found this document useful (0 votes)
9 views1 page

Questions

The document outlines programming tasks that involve basic algorithms and control structures. It includes generating Fibonacci numbers, checking for prime numbers, calculating factorials, summing even numbers, checking palindromes, printing multiplication tables, counting character occurrences, grading scores, finding unique elements in an array, and creating number patterns. Each task emphasizes the use of loops and conditional statements to handle various scenarios and edge cases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Questions

The document outlines programming tasks that involve basic algorithms and control structures. It includes generating Fibonacci numbers, checking for prime numbers, calculating factorials, summing even numbers, checking palindromes, printing multiplication tables, counting character occurrences, grading scores, finding unique elements in an array, and creating number patterns. Each task emphasizes the use of loops and conditional statements to handle various scenarios and edge cases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Fibonacci Sequence: Write a program to generate the first n Fibonacci numbers using

a loop. Make sure to use conditional statements to handle edge cases for n = 0 or n
= 1.

Prime Number Check: Create a function that checks if a number is prime. Use loops
to iterate through possible divisors and conditional statements to evaluate if the
number is divisible by any of them.

Factorial Calculation: Write a function to calculate the factorial of a number


using a loop. Use conditional statements to handle cases where the input is
negative or zero.

Sum of Even Numbers: Write a program that calculates the sum of all even numbers
from 1 to n. Use a loop to iterate through the numbers and a conditional statement
to check if a number is even.

Palindrome Check: Write a function that checks if a given string is a palindrome.


Use loops to compare characters and conditional statements to track mismatches.

Multiplication Table: Create a program that prints the multiplication table of a


number, using a loop and conditional statements to format the output nicely.

Count Occurrences of a Character: Write a program that counts how many times a
specific character appears in a string. Use loops for traversal and conditional
statements to check for matches.

Grade Calculator: Create a function that takes a score and returns a grade (A, B,
C, D, F) based on predetermined ranges using conditional statements.

Find Unique Elements: Given an array, write a function to find and return the
unique elements. Use loops and conditional checks to filter out duplicates.

Number Pattern: Write a program that prints a number pattern, such as a right-angle
triangle made of asterisks (*) or numbers, using nested loops and conditional
statements to control the formatting.

You might also like