- 1- The Fibonacci series
- 0,1,1,2,3,5,8,13,21,……
السلام عليكم ورحمة الله وبركاتة
يابنات أنا أول مرة أطلب وياليت تساعدوني في حل هذي الاسئله
هذي اربعة اسئلة في البرمجة للغة السي بلس بلس
أول سوالين في function
1- The Fibonacci series
0,1,1,2,3,5,8,13,21,……
Begins with terms 0&1 and has the property that each succedding term is the sum of the two preceeding terms. Write a function ، Fibonacci(n) that calculates nth Fibonacci number and displays till that number ,all the numbers.
2- Consider the following (incorrect) factorial function when answering the next three questions:
Int factorial (int n)
{
If (n<=1) return 0;
else return n*factorial(n-1);
}
a) what should be changed in the above function for it to correctly return the factorial of positive integer.
b) What would happen during the execution of the corrected function(the function obtained after the changes in question(a)were made) if the third line was replaced with the following.
else return n*factorial(n-1);
c) would the corrected function (the function obtained after the changes in question(a)were made) return a different factorial value if the first line was replaced with the following .
int factorial(int& n)
arraysهذي السوالين في
1- what 3 pieces of information does the compiler need to know to declare an array.
2- Write a program that inputs students average and return point grades based on following criteria:
5 90-100
4 80-89
3 70-79
2 60-69
1 < 60
This program should use arrays for storing the average and point grades of 10 students.
The output must be something like the one give below: you can use your own data.
Student number
Average
Point grade
1
52
2
04
3
33
4
51
5
01
اسفه الاسئلة كثيرة بس ياليت تساعدوني لاني محتاجاها يوم السبت
على الاقل سوال واحد