Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ronak-goyal-code/c2c-assignment-1


https://github.com/ronak-goyal-code/c2c-assignment-1

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

## Assignment Problems

1. Take a float number as input and print the fractional part of the real number.

2. Write a program to find the difference between ASCII values of two characters, taken as input.

3. Take 3 positive integers as input and print the greatest of them.

4. Take a positive integer input and check if it is divisible by 5 or 3 but not divisible by 15.

5. Take 3 numbers as input and determine if they can be the sides of a triangle.

6. Display the arithmetic progression (AP): 100, 97, 94, ... until all terms are positive.

7. Display the geometric progression (GP): 1, 2, 4, 8, 16, 32, ... up to _n_ terms.

8. Create a calculator that performs basic arithmetic operations (add, subtract, multiply, divide) using a switch case and functions. The calculator should input two numbers and an operator from the user.

9. Input any year from the keyboard. Write a program to determine whether the year is a leap year or not.

10. Write a C++ program to input any character and check whether it is an alphabet, digit, or special character.

11. Write a program to check if a number is prime.

12. Write a program to count the digits of a given number.

13. Write a program to print the reverse of a given number.

14. Print the sum of the series: 1 - 2 + 3 - 4 + 5 - 6 + ... up to _n_ terms.

15. Print the factorials of the first _n_ numbers. Take _n_ as input.

16. Print the _n_ th Fibonacci number.

17. Write a program to print the sum of a given number and its reverse.

18. Write a program to print all Armstrong numbers between 1 and 500. An Armstrong number is one for which the sum of the cubes of each digit equals the number itself (e.g., 153 = \(1^3 + 5^3 + 3^3\)).

## Patterns

19. Print the pattern (input _n_ = 4):
```
A B C D
A B C D
A B C D
A B C D
```

20. Print the pattern (input _n_ = 4):
```
1
1 3
1 3 5
1 3 5 7
```

21. Print the pattern (input _n_ = 4):
```
1
0 1
1 0 1
0 1 0 1
```

22. Print the pattern (input _n_ = 4):
```
****
****
****
****
```

23. Print the pattern (input _n_ = 4):
```
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
```

24. Print the pattern (input _n_ = 4):
```
A
B A B
C B A B C
D C B A B C D
```

25. Print the pattern (input _n_ = 4):
```
*
* * *
* * * * *
* * * * * * *
* * * * *
* * *
*
```

26. Print the pattern (input _n_ = 4):
```
* * * * * * *
* * * * * *
* * * *
* *
```

27. Print the pattern (input _n_ = 4):
```
1 2 3 4 5 6 7
1 2 3 5 6 7
1 2 6 7
1 7
```

28. Print the pattern (input _n_ = 4):
```
A B C D C B A
A B C C B A
A B B A
A A
```

29. Print the pattern (input _n_ = 5):
```
*
* * *
* * *
* * *
* * *
* * * * * * * * * * *
* * *
* * *
* * *
* * *
*
```

30. Print the pattern (input _n_ = 4):
```
* *
* * * *
* * * * * *
* * * * * * * *
* * * * * * * *
* * * * * *
* * * *
* *
```

31. Print the pattern (input _n_ = 4):
```
* * * * * * *
* * * * * *
* * * *
* *
* * * *
* * * * * *
* * * * * * *
```

32. Print the pattern (input _n_ = 4):
```
4 4 4 4 4 4 4
4 3 3 3 3 3 4
4 3 2 2 2 3 4
4 3 2 1 2 3 4
4 3 2 2 2 3 4
4 3 3 3 3 3 4
4 4 4 4 4 4 4
```