Below are 6 problems related to arrays, decision making statements etc.
No solution will be provided for these problems except Bonus Problem.
Problem 1 - Your program should print
- "The weather is Good" if today's temperature is greater than 20 degree and less than 25 degree,
- "The weather is little cold" if today's temperature is less than 20 degree and greater than 15 degree,
- "The weather is cold" if today's temperature is less than 15 degree.
- "The weather is little warm" if today's temperature is greater than 25 degree but less than 30 degree.
- "The weather is warm" if today's temperature is greater than greater than 30 degree and less than 40 degree.
- "The weather is really hot" if today's temperature is greater than 40 degree.
Try, to not to confuse yourself with all these statements and print accordingly to the condition matching the user's input.
Problem 2 - Try to create a program with following rules -
- In main method you should create an array dynamically and allocate memory for it.
- Create a function which take the array as argument and try to initialize this array in the function with the distinct multiples of number 2, but not in main method.
Problem 3 - Create a program which should take two, 2 dimensional arrays as input, and output there product. (Assume that both the arrays are square matrices and both arrays has same dimensions)
Problem 4 - Write a program to calculate the volume of a cube and area of a square.
Problem 5 - Try to create a program with following rules -
- Create and initialize an array in your main method/function and pass it a function.
- The function should return an array (Return means really return).
- The returned array and array which is defined in main must have same sizes.
- The returned array must have every values 2 times the array sent as a paramter.
- The array sent as a parameter should not be modified.
Bonus Problem - Create a Program to print fibonacci sequence. The program should print 93 fibonacci numbers(let's see if you figure out, what I want you to).
Solution to Problem.
If you still don't get, what is wrong in bonus problem, comment below and I will try to clear that concept too.
Before watching this tutorial, please try to solve them by yourself.
Great practice problems
ReplyDelete