Answer:
Codes for each of the problems are explained below
Explanation:
PROBLEM 1 IN C++:
#include<iostream>
using namespace std;
//fib function that calculate nth integer of the fibonacci sequence.
void fib(int n){
// l and r inital fibonacci values for n=1 and n=2;
int l=1,r=1,c;
//if n==1 or n==2 then print 1.
if(n==1 || n==2){
cout << 1;
return;
}
//for loop runs n-2 times and calculates nth integer of fibonacci sequence.
for(int i=0;i<n-2;i++){
c=l+r;
l=r;
r=c;
cout << "(" << i << "," << c << ") ";
}
//prints nth integer of the fibonacci sequence stored in c.
cout << "\n" << c;
}
int main(){
int n; //declared variable n
cin >> n; //inputs n to find nth integer of the fibonacci sequence.
fib(n);//calls function fib to calculate and print fibonacci number.
}
PROBLEM 2 IN PYTHON:
def fib(n):
print("fib({})".format(n), end=' ')
if n <= 1:
return n
else:
return fib(n - 1) + fib(n - 2)
if __name__ == '__main__':
n = int(input())
result = fib(n)
print()
print(result)
Answer:
Explanation:
Reward him if he does his homework/work
If he doesnt do his homework, take things that he loves off of him. and tell him if he does his homework/work he will get them things back
Answer:
Exact answer: a form of energy resulting from the existence of charged particles (such as electrons or protons), either statically as an accumulation of charge or dynamically as a current.
Explanation:
volume = πR²h/3
= πx35²x50/3
= 192325/3
= 64166.725
number of layers n = 50mm/0.05
n = 1000layers
average volume = 64166.725/1000
= 64.167mm³
average area = 64.167/0.05
= 1283.34mm²
average time = 1283.34/900mm x 0.22
= 6.48
6.48 + 15 seconds
= 21.48 seconds
time required = 1000x21.48
= 21480 seconds
convert to minutes
21480/60
= 358 minutes
21480/3600
= 5.967 hours