C& CPP Tutorials
About C
Program Structure
Running C Program
Variables, constants
Operators
Control Structure
Array
Function
Pointers
Preprocessor
Structure
File
Bitwise Operators
Recursion
 Data Structures
Introduction
Stacks
Queues
Linked List
Sorting 
Searching
 Test Your Skill
Fundamentals
Input and Output
Branching and Looping
Function
Pointers I
Pointers II
Structure and Union
Sample Problems I
Sample Problems II
 Help and Support
C Forum
Source code
C  Yahoo Group
C Compilers
 


Challenging Programming Problems - Part I

  
[Q001]
Write a program (W.A.P.) in C to SWAP the contents of 3 variables without using the temporary (or extra) variables.

 
[Q002] W.A.P. in C to find the Fifth root of the sum of the squares of the first 100 ODD numbers only.

 [
Q003] W.A.P. in C to multiply any two numbers without using * (asterisk)
 [Hint : Use BITWISE OPERATORS]

   
[Q004] W.A.P. in C to check whether given number x is equal to the value 2 POWER i or something, where i>=0 using BITWISE operators ONLY. [Hint : Check whether the given number x is equal to the value 2 POWER i or something using BITWISE operators ONLY]

 
[Q005] W.A.P. in C to maintain 2 STACKS within a SINGLE ARRAY and the values of one stack should not overwrite the values of another stack.


 
 [Q006] W.A.P. in C that act as a guessing game in which the user has eight tries to guess a randomly generated number. The program will tell the user each time whether he guessed high or low. The user WINS the game when the number guessed is same as randomly generated number.

 
[Q007]W.A.P. to determine how much money is in a piggy bank that contains several 50 paise coins, 25 paise coins, 20 paise coins, 10 paise coins and 5 paise coins. Use the following values to test your program : Five 50 paise coins, Three 25 paise coins, Two 20 paise coins, One 10 paise coin and Fifteen 5 paise coins. (Answer : Rs. 4.50)

 
[Q008] Modify the program given in [Q007] to accept total amount (in rupees) and convert them into paise.(Vice-versa of [Q007])

  [Q009] W.A.P. in C to determine how many of the characters are vowels and how many are consonants in a given line of text. Also terminate the string when the input character encountered is other than the alphabets(a-z or A-Z) and Blank spaces.
[Hint:(a) When the input string is 'C FOR SWIMMERS, TEST YOUR C PROGRAMMING STRENGTHS'. Consider the string 'C FOR SWIMMERS' only Because ',' is encountered. (b) When the input string is 'Y2K PROBLEM'. Consider the character 'Y' only Because the '2' is encountered.]

Solutions for the above queries.

Back Next
 

Google