# C programs by maryjibi

VIEWS: 42 PAGES: 3

• pg 1
```									                       C Programming(beginners//b c a )
Simple Programs
1. Inter change two number with using third variable
2. Inter change two number without using third variable
3. average of three numbers.
4. Program to find simple interest and compound interest (I=PNR and I=P(1+ r/n)^t ).
5. Program to add, subtract, multiply , divide and modulus of 2 integer numbers. Print
their result.
6. compute x^y .
7. Program to implement bitwise operators.
8. Convert temperature in Fahrenheit to Celsius using the formula
C= (F- 32)/9.8
9. Program to implement all math functions
10. find area and perimeter of a circle using symbolic constant.
11. find area of a triangle using sqrt(s(s-a)(s-b)(s-c)) where s=(a+b+c)/2

Decision Making statements

12. Largest of two numbers
13. Check number is odd / even
14. Check number is positive / negative
15. Check number is divisible by 7
16. Largest of three numbers ( nested if)
17. Input three numbers a, b, c and solve the equation using the formula
x = (-b+-(b2-4ac))/(2*a)
If b2-4ac = 0 we have only one solution ie. x=-b/(2*a)
If b2-4ac >0 we have two solutions
ie. x1 = (-b+(b2-4ac))/(2*a)
x2 = (-b-(b2-4ac))/(2*a)
otherwise imaginary roots
18. Input any number between 0-9 and print in words(else if & swich)
19. Input any number between 1-7 and print the corresponding day of week(else if &
swich)
20. Input two numbers and any choice from the given choices and perform the
corresponding calculation(else if & swich)
Choice
*****************************
2 - SUBTRACTION
3 – MULTIPLICATION
4 – DIVISION
5 – MODULAR DIVISION
*****************************
21. Find the square root of a number if the number is positive else read another number
(goto)
22. Sum of ‘n’ natural numbers (goto)
Looping

23. Print and find the sum & average of all natural numbers upto ‘n’
24. Print and find the sum of all odd numbers upto ‘n’
25. Find the factorial of a given number (5! = 1x2x3x4x5= 120)
26. Find the multiplication table of any number upto ‘n’ numbers
27. Find Sum of digits in a number ( 123 = 1+2+3 =6)
28. Find Reverse of a number ( 123 = 321)
29. Check number is paliandrome or not
30. Check number is Armstrong or not ( 371 = 33+73+13 = 371 )
31. Check number is prime or not
32. Generate Fibonacci series of ‘n’ numbers ( 0 1 1 2 3 5              8 ......)
33. Print the Armstrong numbers between 100 and 1000
34. Print the prime numbers between 1 and 100
35. Print the following patterns

1)*                   2)* *      *    *    3)1                4)1
* *                   * *      *           2 2                1 2
* *      *            * *                  3 3 3              1 2 3
* *      *    *       *                    4 4 4      4       1 2 3      4

One Dimensional Arrays

36. Read & print ‘n’ elements in an array
37. Find the sum and average of ‘n’ elements in an array
38. Count the positive and negative numbers in an array
39. Count the odd and even numbers in an array and also print the elements separately
40. Check the given number is present in an array or not
41. Find the largest number in an array
42. Sort the elements in array in ascending order(using bubble sort)
43. Sort the elements in array in descending order
44. Input two arrays A and B and merge the arrays into third array C and also sort the
elements

Two Dimensional arrays

45. Read and print a matrix of order mxn.
46. Find the sum of 2 mxn matrices.
47. Find the diagonal elements in a matrix.
48. Find the off diagonal elements in a matrix.
49. Find the transpose of a matrix and check whether it is symmetric or not.
50. Find the matrix multiplication of two matrices A & B .
c[i][j]=c[i][j]+a[i][k]*b[k][j];
51. Find the row wise and column wise sum of a matrix.
52. Find the determinant of matrix.

Character test functions

53. Read and print a character using scanf & printf functions
54. Read and print a character using getchar() & putchar() functions
55. Check the given character is an alphabet / digit / printable character
56. Covert the given character to reverse case (uppercase / lowercase)
57. Print the ASCII value of a character

Strings