Java script- question of operators.
Programming Questions
Programming Questions
Here are some programming tasks to sharpen your skills:
-
Q.1: Write a program to calculate the factorial of a given number.
Description: Factorial of a number is the product of all positive integers up to that number. For example, 5! = 5 x 4 x 3 x 2 x 1 = 120.
-
Q.2: Write a program to calculate the squares of numbers from 1 to 10.
Description: Compute and display the square of each number in the range.
-
Q.3: Write a program to print the multiplication table of any given number.
Description: Input a number and display its multiplication table up to 10.
-
Q.4: Write a program to find the reverse of a given number.
Description: Input a number and reverse its digits, such as turning 123 into 321.
-
Q.5: Write a program to check if a given number is a palindrome.
Description: A palindrome is a number that reads the same forward and backward, such as 121.
-
Q.6: Write a program to check if a given number is an Armstrong number.
Description: An Armstrong number equals the sum of its own digits raised to the power of the number of digits, like 153.
-
Q.7: Write a program to calculate the factors of a given number.
Description: Display all numbers that divide the input number perfectly.
-
Q.8: Write a program to check if a given number is a perfect number.
Description: A perfect number is one that equals the sum of its proper divisors, such as 28.
-
Q.9: Write a program to print the Fibonacci Series.
Description: Generate a series where each number is the sum of the two preceding numbers, starting from 0 and 1.
-
Q.10: Write a program to calculate the sum of the digits of a number.
Description: Add all the digits of the input number together.
-
Q.11: Write a program to calculate the sum of squares of n natural numbers.
Description: Compute the sum of squares from 1 to n.
-
Q.12: Write a program to count even and odd numbers from a list.
Description: Input a list of numbers and classify them as even or odd.
-
Q.13: Write a program to find the LCM of two numbers.
Description: Calculate the Least Common Multiple of two given numbers.
-
Q.14: Write a program to find the HCF of two numbers.
Description: Calculate the Highest Common Factor of two given numbers.
-
Q.15: Write a program to check if a given number is a prime number.
Description: Determine if the number has exactly two distinct divisors: 1 and itself.
Leave a Reply