Computer Science & C Programming


Exercices (1/2)

END 2
  1. Define an algorithm to compute r=2^3. answer
  2. Define an algorithm to compute the power r=n^p. answer
  3. Give the corresponding C program by using:
    a. a goto statement, answer
    b. a while statement, answer
    c. a for statement if possible. answer
  4. Give a main program that uses the preceding program and displays the values of 2^8, 2^16, 2^32 and 2^64. answer
  5. How to compute 2^0+2^1+2^2+...+2^8 ?