GIT HUB Assignment
GIT HUB Assignment
C Programming Exercises
Note: All students must upload their code on GitHub and submit your GitHub link for the evaluation
Pattern Exercises
1. Star pattern programs - Write a C program to print the given star patterns.
*
***
*****
*******
*********
*
* *
* *
* *
*********
Hollow Pyramid Star Pattern
*********
*******
*****
***
*
*********
* *
* *
* *
*
*
**
***
****
*****
****
***
**
*
Half Diamond Star Pattern
*
**
***
****
*****
****
***
**
*
Mirrored Half Diamond Star Pattern
2. Number pattern programs - Write a C program to print the given number patterns
Number pattern 1
11111
00000
11111
00000
11111
Number pattern 2
01010
01010
01010
01010
01010
Number pattern 3
11111
10001
10001
10001
11111
Number pattern 4
11111
11111
11011
11111
11111
Number pattern 5
10101
01010
10101
01010
10101
If…Else Exercises
1. Write a C program to find maximum between two numbers.
2. Write a C program to find maximum between three numbers.
3. Write a C program to check whether a number is negative, positive or zero.
4. Write a C program to check whether a number is divisible by 5 and 11 or not.
5. Write a C program to check whether a number is even or odd.
6. Write a C program to check whether a year is leap year or not.
7. Write a C program to check whether a character is alphabet or not.
8. Write a C program to input any alphabet and check whether it is vowel or consonant.
9. Write a C program to input any character and check whether it is alphabet, digit or special
character.
10. Write a C program to check whether a character is uppercase or lowercase alphabet.
11. Write a C program to input week number and print week day.
12. Write a C program to input month number and print number of days in that month.
13. Write a C program to count total number of notes in given amount.
14. Write a C program to input month number and print number of days in that month.
15. Write a C program to count total number of notes in given amount.
16. Write a C program to input angles of a triangle and check whether triangle is valid or not.
17. Write a C program to input all sides of a triangle and check whether triangle is valid or not.
18. Write a C program to check whether the triangle is equilateral, isosceles or scalene triangle.
19. Write a C program to find all roots of a quadratic equation.
20. Write a C program to calculate profit or loss.
21. Write a C program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and
Computer. Calculate percentage and grade according to following:
C Functions Exercises
1. Write a C program to find cube of any number using function.
2. Write a C program to find diameter, circumference and area of circle using functions.
3. Write a C program to find maximum and minimum between two numbers using functions.
4. Write a C program to check whether a number is even or odd using functions.
5. Write a C program to check whether a number is Prime, Armstrong or perfect number using
functions.
6. Write a C program to find all prime numbers between given interval using functions.
7. Write a C program to print all strong numbers between given interval using functions.
8. Write a C program to print all Armstrong numbers between given interval using functions.
9. Write a C program to print all perfect numbers between given interval using functions.
10. Write a C program to find power of any number using recursion.
11. Write a C program to print all natural numbers between 1 to n using recursion.
12. Write a C program to print all even or odd numbers in given range using recursion.
13. Write a C program to find sum of all natural numbers between 1 to n using recursion.
14. Write a C program to find sum of all even or odd numbers in given range using recursion.
15. Write a C program to find reverse of any number using recursion.
16. Write a C program to check whether a number is palindrome or not using recursion.
17. Write a C program to find sum of digits of a given number using recursion.
18. Write a C program to find factorial of any number using recursion.
19. Write a C program to generate nth Fibonacci term using recursion.
20. Write a C program to find GCD (HCF) of two numbers using recursion.
21. Write a C program to find LCM of two numbers using recursion.