Documente Academic
Documente Profesional
Documente Cultură
Example:
--------------------------------------------------------------------------------------------------------------------------------------
Q2) Write a program that requests the user to enter a number then check if its a prime number or
not?
Example:
--------------------------------------------------------------------------------------------------------------------------------------
Q3) Write a program that requests the user to enter numbers then store them into an array then sorts
them from the smallest number to the largest number.
Example:
--------------------------------------------------------------------------------------------------------------------------------------
Q9) Write a program that requests from the user a string with one word then check if that word is the
same if flipped.
Example:
--------------------------------------------------------------------------------------------------------------------------------------
Q16) Write a program that requests the user to enter a string. if the letters in the word are more than
or equal to 3 characters, it makes the first letter capital and all the letters in the strings small.
Example:
--------------------------------------------------------------------------------------------------------------------------------------
Q17) write a program that converts an entered integer into a string without using the function strtod()
or any similar functions
Q7) Write a program that takes a number then prints a pyramid with rows equal to the entered
number.
Example:
***
*****
***
*****
*******
*********
--------------------------------------------------------------------------------------------------------------------------------------
Q5) Write a program that requests the user to input 3 values rows, columns and element then creates
a rows*column sized matrix with all its elements equal to element.
Example:
--------------------------------------------------------------------------------------------------------------------------------------
Q15) Write a program that continues to add all the digits of a number until it becomes a one digit
number.
Example :
28049=> 23 => 5
Q4) Write a program to calculate the result of summing two 3*3 matrices.
Example:
matrix1:
123
456
789
matrix2:
222
222
222
345
678
9 10 11
--------------------------------------------------------------------------------------------------------------------------------------
Example:
1. enter vector1: 1 1 1
enter vector2: 0 1 -1
the dot product is 0
2. enter vector1: 1 1 1
enter vector2: 2 2 2
the dot product is 6
--------------------------------------------------------------------------------------------------------------------------------------
Q10) Write a program that requests the user to enter a number then finds another number which is
the difference between its digits.
Example:
--------------------------------------------------------------------------------------------------------------------------------------
Q14) Write a program that finds the numbers of words in a string that are greater than or equal a
requested input
Example :
--------------------------------------------------------------------------------------------------------------------------------------
Q8) Write a program that finds the distribution of the student marks in a class. the enter the number
of students first then find the distribution as shown below.
Example:
Student 1: 87
Student 2: 68
Student 3: 94
Student 4: 100
Student 5: 83
Grade distribution:
0-9:
10-19:
20-29:
30-39:
40-49:
50-59:
60-69: *
70-79:
80-89: **
90-99: *
100: *
Q13) write a program that finds the prime factor of the number
Example
546 / 2
273 / 3
91 / 7
13 / 13
1
--------------------------------------------------------------------------------------------------------------------------------------
Q11) Write a program that takes two numbers then finds the bit-wise multiplication. if the result of
the multiplication is greater than 9 take the ones digit only.
Example:
--------------------------------------------------------------------------------------------------------------------------------------
Q12) Write a program that creates a unity matrix with a size selected by the user.
Example:
the matrix:
100
010
001
--------------------------------------------------------------------------------------------------------------------------------------
Q16) Write a program that tells the user to enter a string then finds the different number of letters in
that string.
Example:
Example:
--------------------------------------------------------------------------------------------------------------------------------------
Q18) Write a program that finds that takes two times in the HH:MM format then returns the difference
between them in minutes.
Example:
--------------------------------------------------------------------------------------------------------------------------------------
Q20) Write a program that requests from an integer then finds the result of the following equation:
1 1 1 1
= 1 +
2 3 4
using a recursive function.