Fibonacci sequence is simply by adding up the two numbers before it. The numbers are similarly related to Lucas Numbers which is another mathematical sequence. Problem #4 : Fibonacci //—www.skellainnovations.com—// #include<iostream> #include<conio.h> #include<windows.h> using namespace std; void gotoxy(int x, int y) { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); COORD pos; pos.X = x; pos.Y = y; SetConsoleCursorPosition(hConsole,pos); […]
CPP-Breakdown
Problem # 3: Ascending Asterisk (Christmas Tree Shape) //—www.skellainnovations.com—// #include<iostream> #include<conio.h> using namespace std; int main() { int a,b,c,n; cout<<“Enter a Number: “; cin>>n; for(a=1;a<=n;a++){ for(b=a;b<n;b++){ cout<<” “;} for(c=1;c<=a;c++){ cout<<“* “;} cout<<endl;} getch (); } //—www.skellainnovations.com—// Breakdown of Codes Problem Overview Variables n : integer > value : input number a : integer > value : 1st […]
Problem # 2: Descending Numbers (Rotated Half Triangle Shape) //—www.skellainnovations.com—// #include <iostream.h> #include <conio.h> #define ct cout void dec(int x); int main() { clrscr(); int x; ct<<“Enter a Number: “; cin>>x; dec(x); getch(); return 0; } void dec(int x) { int a,b; for(a=x;a>=1;a–) { for(b=a;b>=1;b–) { ct<<b; } ct<<endl; } } //—www.skellainnovations.com—// Breakdown of […]
Problem # 1: Numbers to Text Conversion //—www.skellainnovations.com—// #include<iostream> #include<conio.h> #include<windows.h> using namespace std; void gotoxy(int x, int y) { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); COORD pos; pos.X = x; pos.Y = y; SetConsoleCursorPosition(hConsole,pos); } int main(){ int a,b,c,d,e; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11); gotoxy(20,12); cout << “Enter Number : “; cin >>a; gotoxy(20,16); if (a==0){ switch (a) case […]