Sample - Programs Pps
Sample - Programs Pps
1. Write a Program to add,multiply, subtract and division operations on the given two integers.
Inputs : a, b 45 34
Output
Addition is 45 + 34 = 79
Difference is 45 – 34 = 11
Multiplication is 45 * 34 =
Quotient is 45/34 = 1
Remainder is 45 % 34 = 11
Division is 45 / 34 = 1.24
2. Repeat the Above for Floating point variables without quotient and remainder
3. Write a Program to find the sum of first ‘n’ Natural Numbers
Sum= n (n+1) /2
Ex: input 4
Sum = 4 ( 4+1)/2 = 4*5 /2 =10
4. Write a Program to Convert Fahrenheit Temperature to celsius
C = 5/9 (f-32)
5. Write a program to find sum,difference,multiplication and division of the given two complex
numbers
Ex: First Complex Number a, b (RealPart + I imaginary Part)
Second Complex Number c, d (RealPart + I imaginary Part)
6. Convert the given Minutes into Days, Hours and remaining Minutes
Ex: 2000
±√
Roots = 𝑥 = Calculate separately when roots are imaginary
26. Check whether the given character is special symbol , digit or alphabet
27. Separate the given integer into position digits
6458 1s position digit is 8 , 10s position digit is 5 , 100s position digit is 4 and 1000s
position digit is 6
28. Write text for the given 1s position digit
1 one 2 two 3 three …….
29. Write text for the given 10s position digit and 1s position digit
30. To print the label according to the given age
0 - 3 Baby
4 - 10 Elementary School
11 - 15 High School
16 – 21 College
22 – 30 Learning Age
31 – 55 Young and Energitic
56 – 70 Knowledgeable Person
71 – 90 Old
91 – 120Great Person
31. To print week name when week no is given
32. To print month name when month no is given
33. To print given number is even or odd
34. To check whether the given year is a leap year or not
35. To display a statement with SNO for n times.
“WELCOME TO CPP” for n times
36. To find sum of all the numbers between the given two numbers
37. To find product of all the numbers between the given two numbers
38. To print the multiplication table of the given number
39. Find the sum of the squares of the numbers between the given two numbers
40. To find the Reverse Number of the given number
41. To check whether the given number is palindrome or not
42. To print all the factors given number n
43. To find the factorial of the given number n
44. To find npr and ncr
45. Find the GCD & LCM for the given two numbers
46. To print all the numbers between n1 and n2 which are divisible by d.
47. To check whether the given number is perfect or not
48. Print all perfect numbers between the given two numbers
49. To check whether the given number is prime or not
50. To print all prime numbers between the given two numbers
51. Find Fibonacci series below the given number n
52. Print all twin primes below the given number n
53. To check the given number is Armstrong or not
54. To print all the Armstrongs between the given two numbers
55. To check the given number is strong or not
56. To print all the strongs between the given two numbers
57. To find the digit sum of the given integer
58. To find the lucky number of the given integer
4538 4+5+3+8 = 20 = 2+0 = 2
59. To check whether the given number is HAPPY Number or not
60. To Print all happy numbers between the given two numbers
61. Exp(x)= 1 + + + +⋯
! ! !
62. Sin(x)= x − + +⋯
! !
63. Cos(x)= 1 − + +⋯
! !
64. to print all leap years between the given two years
65. to convert Decimal number to Binary System
66. To Convert Decimal to Octal
67. To Convert Decimal to Any system
68. To Convert Octal to Decimal
69. *
**
***
****
*****
70. *****
****
***
**
*
71. *
* *
* * *
* * * *
* * * * *
72. *
* *
* * *
* * * *
* * * * *
* * * * *
* * * *
* * *
* *
*
73. **********
**** ****
*** ***
** **
* *
74. 0
01
010
0101
01010
75. 0 0
01 01
010 010
0101 0101
0101001010
76. 12345
1234
123
12
1
77. 1
123
12345
1234567
123456789
78. 1 1
12 21
123 321
1234 4321
1234554321
79.
123454321
1234321
12321
121
1
80.
A
B C
D E F
G H I J
K L M N O
81.
1A2B3C4D5E
1A2B3C4D
1A2B3C
1A2B
1A
82.
A
ABA
ABCBA
ABCDCBA
ABCDEDCBA