Write a program in C++ to display first 10 Fermat numbers
- برمجة سي بلس بلس
- برمجة
- 2021-05-14
- MarwaMohammed
الأجوبة
# include <iostream>
# include <math.h>
using namespace std;
int main()
{
int n=0;
double result;
cout << "\n\n Display first 10 Fermat numbers:\n";
cout << "-------------------------------------\n";
cout << " The first 10 Fermat numbers are: "<<endl;
while (n <= 10)
{
result= pow(2, pow(2, n)) + 1;
n++;
cout << result << endl;
}
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال