Directory

Encyclopedia

NodeWorks
                              ENCYCLOPEDIA

Link Checker

Home
Encyclopedia : P : PR : PRO :

Programming problems

 

Programming problems

This page gives a list of programming problems. These are useful for anyone who want to learn programming quickly. Each problem has a problem statement and the required output along with multiple solutions (including flawed and ill-performing solutions).

Hello world
Write a program to display “Hello world”

Addition of 2 numbers

Write a program to add two numbers

Greatest of 3 numbers

Find the greatest of three numbers

Greatest of N numbers

Find the greatest of N numbers where N is any arbitrary natural number

Factorial or Product of N numbers
Given N as input find N!
Example:
N = 4
Output is 24 because 1 x 2 x 3 x 4 = 24

Average of N numbers
Find the average of N numbers

Generate prime numbers
Write a program to generate N prime numbers

Prime or not
Determine whether given number N is prime or not

Generate Fibonacci series
Write a program to generate the Fibonacci series which goes like this 1, 1, 2, 3, 5, 8, 13, 21…..

Factorisation

Break down a number into its prime factors

Lowest common divisor
Write a program to determine the lowest common divisor for two numbers

Lowest common divisor for N numbers

Write a program to determine the lowest common divisor for N numbers

Highest common factor
Find the highest common factor for the two given numbers

Highest common factor for N numbers
Find the highest common factor for the N given numbers

Quadratic roots
Find the roots of a quadratic equation Ax2 + Bx + C = 0 given the coefficients A, B, C

Area and volume
Write a program to determine the areas and/or volumes of the following geometric entities
i) Circle
ii) Square
iii) Rectangle
iv) Cuboid
v) Sphere
vi) Cone
vii) Cylinder


Number Series generation

Arithmetic
• 1, 2, 3, 4, ...
• 1, 3, 5, 7, 9, ...
• 2, 4, 6, 8, …
• 10, 15, 20, 25 …
Geometric
• 2, 4, 8, 16 …
• 10, 100, 1000, 10000, …
• 3, 27, 19683, …

Evaluate cos(x) , sin(x)
Write a program to determine the sine and cosine value of given input x.
i) using any inbuilt math library functions
ii) by using the series given below
(or)

Guess the number
Ask the user to guess a number between 1 and 100. Try to guess it using the following logic.
Say user has chosen number 80
Prog: Is number 50?
User: G (My number is greater than that)
Prog: Is number 75?
User: G
Prog: Is number 87?
User: L (My number is lesser than that)
Prog: Is number 81?
User: L (My number is lesser than that)
Prog: Is number 78?
User: G
Prog: Is number 79?
User: G
Prog: Is number 80?
User: Y

Digits of a Number
Write a program to display the digits of a number.
Example:
Input N is 4219 (say)
Output should be 4, 2, 1, 9


Number from digits

Write a program to generate the number given the digits
Example:
The given digits are 4, 2, 1, 9
Output should be 4219

Reverse a number
Write a program to reverse a number
Example:
Output should be 9124 given 4219

Super-prime

Write a program to find whether N is a super-prime or not
Input: 7331 (is super prime)
Input: 4550 (is not super prime)
Hint: 7331 is super-prime because, 7331, 733, 73 and 7 are primes

Armstrong number
Write a program to determine whether a number is Armstrong number or not
Hint: A number is Armstrong if the sum of cubes of its digits is equal to the number itself
Input: 371 (is Armstrong)
Input: 456 (is not Armstrong)

Generate list of random numbers

Write a program to use an inbuilt library function to generate a list of random numbers.
Also try as an added exercise to write a pseudo-random number generator

Print ASCII table

Matrix addition Matrix Multiplication
Palindrome
Printing practice (Stars and numbers)
String manipulation (String concatenation, sub string, remove spaces)
Search and replace in strings
Time and date display
Date difference
Eight queens solution checking
Eight queens recursive solution
Eight queens non-recursive solution
Permutations
Combinations
Anagram checking
Anagram generation
Number system conversion
Travelling salesman problem
Bin-Packing problem
Sort N numbers
Sort strings in array
Linear search
Binary search
Hashing
Indexing
Binary trees
B+ trees
Linked list
Adaptive multiple choice quiz
Telephone directory
Expression solving
Caesar encryption
XOR encryption
Random name generation
copy and move files
List all directories using recursion and without
Spawn a shell process
Run two threads
Calculator
Stack
Queues
Curve fitting
Line fitting
Solution of Linear equations
Minimax search
Preprocessor for C
Expression evaluation
Sorting in Files
Leap year
Calendar generation
Arithmetic encoding
LZW text compression
RSA encryption
DES encryption
Polyalphabetic and Monoalphabetic encryption

-- 09:25, 17 Apr 2005 (UTC)


NodeWorks boosts web surfing!
Page Returned in 0.052 seconds - HTML Compressed 68.3%

This article is from Wikipedia. All text is available
under the terms of the GNU Free Documentation License.
 GNU Free Documentation License
© 2008 Chamas Enterprises Inc.