Advertisement
Mizuhara_Chizuru

Coding Ninja Surya's Answers Lecture 7: Functions

Jan 4th, 2022
97
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ***************MCQs answers
  2. void
  3. int
  4. 19
  5. Compilation error
  6. *********************Farenheit to Celcius
  7.  
  8. void printTable(int start, int end, int step) {
  9.     /* Don't write main().
  10.      * Don't read input, it is passed as function argument.
  11.      * Print output and don't return it.
  12.      * Taking input is handled automatically.
  13.      */
  14.      for(int i=start;i<=end;i+=step)
  15.          cout<<i<<'\t'<<((i-32)*5)/9<<'\n';
  16. }
  17.  
  18. ****************Fibonacci
  19.  
  20.  
  21. bool checkMember(int n){
  22.  
  23.   /* Don't write main().
  24.    * Don't read input, it is passed as function argument.
  25.    * Return output and don't print it.
  26.    * Taking input and printing output is handled automatically.
  27.   */
  28.  
  29. int a=0,b=1,i,temp;
  30.     if(n==0)
  31.         return 1;
  32.     else if(n==1)
  33.         return 1;
  34.     else
  35.     {
  36.         for(i=1;i<=10000;i++)
  37.         {
  38.             temp=b;
  39.             b=b+a;
  40.             a=temp;
  41.             if(b==n)
  42.                 return 1;
  43.         }
  44.     }
  45. return 0;
  46. }
  47.  
  48.  
  49.  
  50.  
  51. *********MCQs Answers
  52.  
  53. Yes
  54. No
  55. 8
  56. 5
  57. 16
Advertisement
RAW Paste Data Copied
Advertisement