0% found this document useful (0 votes)
2 views

javatest

The document outlines a series of programming tasks that cover various concepts such as grading systems, prime number detection, number reversal, Armstrong number detection, number-to-words conversion, Fibonacci series generation, magic number detection, login attempt limiting, and creating an interactive menu. Each task specifies the required logic and control structures, including loops and conditionals. The tasks are designed to enhance programming skills in handling numbers and user interactions.
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)
2 views

javatest

The document outlines a series of programming tasks that cover various concepts such as grading systems, prime number detection, number reversal, Armstrong number detection, number-to-words conversion, Fibonacci series generation, magic number detection, login attempt limiting, and creating an interactive menu. Each task specifies the required logic and control structures, including loops and conditionals. The tasks are designed to enhance programming skills in handling numbers and user interactions.
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/ 2

1.

Grading System
Take marks of 5 subjects and calculate the average. Use if-else to assign grades:

A for avg ≥ 90

B for avg ≥ 80

C for avg ≥ 70

D for avg ≥ 60

F otherwise

2. Prime Number Between 1 and 100


Using a for loop, print all prime numbers between 1 and 100.

3. Reverse a Number
Take an integer input and reverse it using a while loop.

4. Detect Armstrong Numbers from 1 to 999


An Armstrong number is a number whose sum of cubes of digits equals the number
itself.
E.g., 153 = 1³ + 5³ + 3³
Use nested for loops and if-else.

5. Number to Words Converter


Input: 541
Output: Five Four One
Use switch for each digit and process the number in correct order.

6. Print Fibonacci Series until N (using do-while)


Write a program that takes N and prints the Fibonacci sequence up to N using a do-
while loop.

7. Magic Number Detector


A magic number is a number whose recursive sum of digits is 1.
E.g., 19 → 1+9 = 10 → 1+0 = 1 → Magic
Use while loop and if-else to write the logic.

8. Login Attempt Limiter (while loop)(scan Account Number and PIN number)
Allow 3 login attempts using a while loop. After 3 wrong inputs, display: "Account
locked."

9. Interactive Menu with Exit (do-while + switch)


Create a menu-driven program using do-while and switch:

Check even/odd
Check prime
Reverse a number
Exit
Use a switch case to allow users to choose from:

Print square pattern


Print triangle pattern
Print X pattern
Exit
Use nested for loops for patterns.

You might also like