CP assignment unit II

This page is specially for my friends at coep!

This page contains the 8 programs given in the assignment:

1.Program to interchange two nos. without using temporary variable.

2.Program to print summation of given set of nos.

3.Program to print sine of a given angle without using sine() function

4.Program to print fibbonacci series of n terms.

5.Program for finding square root of a number without using sqrt() function.

6.Program to find the greatest common divisor of two nos.

7.Program for generating first n prime nos.

8.Program for raising a number to a larger power.

IF YOU LIKE THE PAGE OF FOR ANY FURTHER DOUBTS DO COMMENT!

Comments
  1. […] HomeAboutCP assignment unit I […]

  2. unknown says:

    THANK YOU!!! for sending such useful program . I am not gating arrays so please send me some useful program and some other information so i can learn arrays. Again thank you.

    • mayur404 says:

      definetly i will surely update it!
      keep visiting!

      • hey ur GCD program seems to be faulty. u have found the difference not the greatest divisor. plz change it so that others arent misleaded. thanks 🙂

      • decoder404 says:

        it isn’t wrong you dry run the program and check by taking some values for a and b
        eg. take a=12 and b=8
        the expected output is 4
        fist it will check the while condition i.e a!=b, as the cond is satisfied then it will check if(a>b) ans is yes therefore a=a-b
        the new value of a=4 and b=8
        again it will check the while(a!=b) the cond is satisfied then it will check if(a>b) ans is no therefore else cond is executed that is b=b-a
        the new values of b=4 and a=4
        then check while(a!=b) but a=b therefore it will come out of loop and print a i.e 4 whick is the desired o/p
        thanks!
        keep visiting!

Leave a comment