Expressing Algorithms-Iteration

 

  1. C program that accepts a positive integer n and prints sum of all first n positive integers.
  2. C program that accepts a positive integer n and prints sum of first n odd numbers.
  3. C program that accepts a positive integer n and finds answer of the series:-
    S = 1 – 2 + 3 – 4 + 5 – 6 + 7 – 8 + …………..upto n terms.
  4. C program that accepts a positive integer n and finds answer of the series:- S = 1/2 + 3/4 + 5/6 + 7/8 ….. upto n terms.
  5. C program that finds the factorial of a positive integer n.
  6. C program that finds the LCM and GCD of two positive integers.
  7. C program that accepts an integer n and accepts n numbers. The program should print the count of positive numbers , negative numbers and zeroes and find out the sum and average of positive numbers and negative numbers separately.
  8. C program that accepts a positive integer n and finds answer of the series:- S = 2 + 4 + 8 + 16 + 32 + 64 + ………. upto n terms.
  9. C program that accepts angle in degrees and finds the cosine of the angle using the series:- cos x = 1 – x2/2! + x4/4! – x6/6! + ………. Upto n terms.
  10. C program that accepts a float value x and integer y and prints xy without using library function.
  11. C program that accepts principal, rate of interest and period in years and calculates the amount payable when compounded annually.
  12. C program that accepts positive integer n and prints first n terms of Fibonacci series and sum of all these terms.
  13. C program that prints all three digit Armstrong numbers.
  14. C program to print the following pattern.
    1
    1 2
    1 2 3
    1 2 3 4
    1 2 3 4 5
  15. C program to print the following pattern.
    1 2 3 4 5
    1 2 3 4
    1 2 3
    1 2
    1
  16. C program to print the following pattern.
    5 4 3 2 1
    5 4 3 2
    5 4 3
    5 4
    5
  17. C program to print the following pattern.
    5
    5 4
    5 4 3
    5 4 3 2
    5 4 3 2 1
  18. C program to print the following pattern.
    1
    2 2
    3 3 3
    4 4 4 4
    5 5 5 5 5
  19. C program to print the following pattern.
    1
    2 3
    3 4 5
    4 5 6 7
    5 6 7 8 9
  20. C program to print the following pattern.
    1 0 1 0 1
    0 1 0 1
    1 0 1
    0 1
    1
  21. C program to print the following pattern.
    A
    A B
    A B C
    A B C D
    A B C D E
  22. C program to print the following pattern.
    A B C D E
    A B C D
    A B C
    A B
    A
  23. C program to print the following pattern.
    E
    E D
    E D C
    E D C B
    E D C B A
  24. C program to print the following pattern.
    E D C B A
    E D C B
    E D C
    E D
    E
  25. C program to print the following pattern.
    A B C D E D C B A
    A B C D    D C B A
    A B C            C B A
    A B                   B A
    A                          A
  26. C program to print the Pascal triangle.
  27. C program to print the following pattern.

    1

    12A

    123AB

    1234ABC

    12345ABCD

  28. C program that accepts a positive integer and prints the sum of digits, product of digits and reverse number.
  29. C program that accepts a positive integer and checks whether it is prime or composite.
  30. C program that accepts a positive integer and prints the number in such a way that every digit will be replaced by the corresponding word. eg. 6485—> six four eight five
  31. C program that accepts a positive integer and prints its prime factors.
  32. Menu driven c program that displays the following menu:-
    1. Addition
    2. Subtraction
    3. Multiplication
    4. Division
    5. Quit
    The program should read option from user repeatedly and perform corresponding operation until user opts for quit.
  33. C program that reads a character from the user and displays message whether it is a vowel or consonant or digit or any other character.
  34. C program that reads a character from the user. If the character is uppercase letter then it should print the corresponding lowercase letter and vice-versa and if it is any other character then it should be printed as it is.
  35. C program to generate prime numbers between 1 to 100.
  36. C program to display the following pattern.

    A B C D

    A B C

    A B

    A

  37. C program to display n lines of the pattern.

    A

    B B

    C C C

    D D D D

  38. C program to display n lines of the pattern.
    1
    2  3
    4  5  6
    7  8  9  10
  39. C program to display the following pattern.

    *

    *    *

    *    *    *

    *    *

    *

  40. C program to display the following pattern.
    5
    4 4
    3 3 3
    2 2 2 2
    1 1 1 1 1
  41. C program to find the sum of the series 1/2 – 3/4  + 5/6 – 7/8 + …….. upto n terms.