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

Programs to be made

The document contains a list of programming tasks that involve various functions and algorithms, including number conversions, sequence generation, mathematical calculations, and data structures. Each task is described with specific requirements, such as input types and expected outputs. The tasks cover a wide range of programming concepts suitable for practice and learning.

Uploaded by

Mubashar Hussain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Programs to be made

The document contains a list of programming tasks that involve various functions and algorithms, including number conversions, sequence generation, mathematical calculations, and data structures. Each task is described with specific requirements, such as input types and expected outputs. The tasks cover a wide range of programming concepts suitable for practice and learning.

Uploaded by

Mubashar Hussain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Statements

1. Write a function that inputs a decimal number and converts it to binary digits.

2. Write a function that counts the number of zeroes, odd, and even numbers.

3. Write a function that print a triangle of stars.

4. Write a program that prints the following sequence using loop.


(E.g. if N=6).

11

11

5. Write a program that enters an integer from the user and displays Fibonacci numbers.

6. Write a program that calculates Fibonacci series of a number using Recursive function.

7. Write a program that inputs an integer and passes it to a function. The function should return the
number of digits in the integer.
(E.g., if integer=5463, the function should return 4.)

8. Write a program that inputs five integers in two arrays each. Declare a function that accepts four
parameters. The first parameter is the first array and the second parameter is the second array. The
function adds the corresponding values of first two arrays and stores the result in another array and
then finally displays the values of all arrays.
Page 1 of 7
9. Write a program that inputs ten floating point numbers in an array. It displays the values which are
greater than the average value of the array.

10. Write a program to print the following output using loop

#####*#####

####*#*####

###*###*###

##*#####*##

#*#######*#

*#########*

11. Write a program that print following sequence using loop (if N=6).

11

12. Write a program which prints a positive integer in binary representation. Do not use array.

13. Write a program which shows your name by stars using loops.

14. Write a program that creates a simple calculator. It reads two float numbers N1, N2 and a character CH
(+,-,*, /), then perform calculation depending upon the type of character entered by user and display
result in format …N1 op N2=result.

15. Write a complete program that calculates roots of quadratic equation. Implement all three cases of
cases.(roots are equal/roots are real/roots are imaginary)

Page 2 of 7
16. Read two positive integer numbers N1 and N2, then test whether the large number is exactly divisible
by the smaller one. In the process, check that the input numbers are valid (N1 and N2>0) and then
check which of the number is greater.

17. Write a program that takes the lengths of the two legs of a right triangle as input and calculates area
and hypotenuse.

18. A pharmaceutical company pays 10% house rent of basic salary & 90% daily allowance of basic salary
to its employees if the basic pay of the employees is less than 1500. The Company pays 20% house rent
& 95% daily allowance of basic salary if the basic pay of the employee is greater than or equal to 1500.

Write a program that takes basic salary of an employee and calculate & print his gross salary.

19. Write a program to calculate factorial of an input of a positive number and then give the sum of
squares of all integers less than that integer.

20. Write a program that print following sequence using loop (if N=6).

10

12

14

10

-2

21. Write a program that uses for loop to calculate and print the product of the integers from 1 to 250
which are divisible by 3.

22. Write a program that uses a for loop statements to sum a sequence of integers .assume that the first
integer read specifies the number of values remaining to be entered. Your program should read only
one value per statements. A typically input sequence might be 5 100 200 300 400 500

23. Write a Program to calculate PI = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + 4/13
Page 3 of 7
24. 01/01/1990, the day was Monday. If any date entered (i.e. 05/04/2005) is input through keyboard,
write a program to find out day of that date.

25. Write a program that reads non-zero double values and determines and prints whether they could
represent the sides of a triangle.

26. Write a program which will product a table of values of j, k and m, where m varies 1 to 6 and for each
value of m, k varies from 5.5 to 12.5 in steps of 0.5.

27. Write a program that input an integer and checks number is perfect, deficit or abundant.

28. Write a program that input numbers and determines whether it is a palindrome.

29. Write a program that input 10 numbers and finds minimum common divisor.

Note: Do not include 1.

30. Write a program that reads unsigned number in the range 10-60000 and displays how many numbers
are completely divisible by 9, odd and even using while loop.

31. Write a program to print following sequence:

1 2 3 4 5 6 7 8 9

1 1 2 3 4 5 6 7 8 9

2 2 4 6 8 10 12 14 16 18

3 3 6 9 12 15 18 21 24 27

4 4 8 12 16 20 24 28 32 36

5 5 10 15 20 25 30 35 40 45

Page 4 of 7
32. Write a program that print following sequence using loop (if N=6).

13

17

21

25

29

20

11

33. Use an array to solve 20 numbers, each of which is between 10 and 100 inclusive. As each number is
read, validate it and store it in the array only if it is not a duplicate of a number already read. After
reading all the values, display only unique value that user enters.

34. Write a program using loops that runs unlimited times unless we press “y” or "n".

35. Write a program that differentiates the ++a and a++.

36. Write a program using array which stores names, numbers and roll numbers of users and displays on
demand.

37. Write a program that displays the names of Islamic months (and tells the user; which Islamic month is
the first, second etc on user's demand) and so on.

38. Write a program that calculates the area of acute triangle in which both sides and angle entered by
user.

39. Write a program that input 4 matrix of different order from user and then result show multiplication,
addition and subtraction.

40. Write a program that input angle in the form of D*M’S” and show result in decimal form.

Page 5 of 7
41. Write a program that input a string from user and result show how many arrangements of that string
words.

42. Write a program that input a matrix of 5*5 and show result of determinant of that matrix.

43. Write a program that input a matrix any order and show it singular or non-singular.

44. Write a program that input matrix of any order and result show inverse of that matrix.

45. Write a program that input a number and find integer is rational, recurring or complex number.

46. Write a program that input a string a show reverse of that string
(I.e. ENTER results as RETNE)

47. Write a program that inputs a number. Result shows cube, square and square root of that number.

48. Write a program that acts like a Traffic Light.

49. Write a program in which header file of math is fully used.

50. A company wants to transmit data over the telephone, but is concerned that its phones could be
tapped. All of the data are transmitted as four-digit integers. The company has asked you to write a
program that encrypts the data so that it can be transmitted more securely. Your program should read
a four-digit integer and encrypt it as follows: replace each digit by the sum of that digit plus 7 modulus
10.then, swap the first digit with the third, swap the second digit with the fourth and print the
encrypted integer .write a separate program that inputs in encrypted four digit integer and decrypts it
to from the original number.
51. Write a program to print the following sequence;

1
1 3
1 3 5
1 3 5 7

52. Write a program to print the following sequence;

1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4
5 6 7 8 9 8 7 6 5

Page 6 of 7
53. Write a program to print the following sequence;

2
2 3 2
2 3 4 3 2
2 3 4 5 4 3 2
2 3 4 3 2
2 3 2
2

54. Write a program that multiplies elements of odd indexes of an array of size N.

55. Write a program to multiply two arrays.

Page 7 of 7

You might also like