Here are the answers of my quiz #07.
\nQuestion 1
\n#include <iostream>
\nusing namespace std;<\/p>\n
long fibonacci(long x){
\nlong y=0, z=1, w=0;
\nwhile (x>1)
\n{
\nw=y+z;
\ny=z;
\nz=w;
\nx=x-1;
\n}
\nreturn w;
\n}<\/p>\n
int main()
\n{
\nlong x;
\ncout << “Introduce un n\u00famero”<< endl;
\ncin >> x;
\nif (x==1)
\n{
\nint w=1;
\ncout << “De acuerdo a la sucesi\u00f3n fibonacci el n\u00famero es “<< w << endl;
\n}
\nelse
\n{
\ncout << “De acuerdo a la sucesi\u00f3n fibonacci el n\u00famero es “<<fibonacci(x) << endl;
\n}
\nreturn 0;
\n}<\/p>\n
<\/a><\/p>\n Question 2 bool IsPalindrome(string x) if (x == palabra){
\n#include <iostream>
\n#include <string>
\nusing namespace std;<\/p>\n
\n{
\nint w= x.length();
\nstring palabra=””;
\nint y=w-1;
\ndo {
\npalabra=palabra+x[y];
\ny=y-1;
\n} while (y>=0);<\/p>\n
\nreturn true;}
\nelse {
\nreturn false;}
\n}
\nint main ()
\n{
\nstring x;
\ncout << “Escribe una palabra ” << endl;
\ncin >> x;
\nIsPalindrome(x);
\nif (IsPalindrome(x) == true){
\ncout<<“Es un pal\u00edndromo”<<endl;
\n}else{
\ncout<<“No es un pal\u00edndromo”<<endl;
\n}
\nreturn 0;}<\/p>\n