├── C++ Course.jpg ├── README.md ├── Timeline └── Timeline of C++ Course.pdf ├── Week 1 ├── .vscode │ ├── c_cpp_properties.json │ └── settings.json ├── 1.1 Introduction to C++ │ └── 1.1 Lecture Notes.pdf ├── 2.1 Data Types & Type Modifiers │ └── 2.1 Data Types Notes.pdf ├── 2.2 Input-Output │ ├── 2.2 Input_Output in c++.pdf │ ├── hello_guys.cpp │ └── tut1.cpp ├── 2.3 If-Else Statement │ ├── 2.3 if_else.pdf │ ├── conditional.cpp │ ├── conditional_statement.cpp │ ├── finding_EvenOdd.cpp │ ├── if_else.cpp │ ├── nested_if_else.cpp │ └── program_to_check_number_is_even_or_odd.cpp ├── 2.4 Introduction to Loops │ ├── 2.4 Loops.pdf │ ├── creating_table_using_for_loop.cpp │ ├── printing_number_using_while_loop.cpp │ ├── program_to_add_onlt_positive_numbers.cpp │ └── sum_of_all_natural_nos_till_n.cpp ├── 3.1 Break and Continue │ ├── 3.1 Jumpsinloops.pdf │ ├── check_the_given_no_is_prime_or_not.cpp │ ├── print_all_odd_numbers_till_n.cpp │ └── print_all_prime_no_in_given_range.cpp ├── 3.2 Switch Case Statement │ ├── 3.2 Switch-Case statement.pdf │ ├── program_to_find_whether_an_alphabet_is_vowel_or_consonant.cpp │ └── program_to_write_simple_calculator.cpp ├── 3.3 Operators in C++ │ ├── 3.3 Operators.pdf │ ├── post_and_pre_increment_example01.cpp │ ├── post_and_pre_increment_example02.cpp │ ├── post_and_pre_increment_example03.cpp │ ├── post_and_pre_increment_example04.cpp │ ├── post_and_pre_increment_example05.cpp │ ├── precedency_example_01.cpp │ ├── precedency_example_02.cpp │ ├── precedency_example_03.cpp │ ├── precedency_example_04.cpp │ └── ternary_conditon_example.cpp └── README.md ├── Week 3 ├── 7.1 Time Complexity │ └── 7.1 Time Complexity.pdf ├── 8.1 Introduction To Arrays │ ├── .vscode │ │ └── settings.json │ ├── 8.1 Arrays.pdf │ ├── pr_01_array.cpp │ ├── pr_02_user_array.cpp │ └── pr_03_max-min.cpp ├── 8.2 Searching in Arrays │ ├── README.md │ ├── pr_01_linear_search.cpp │ └── pr_02_binary_search.cpp ├── 8.3.1 Sorting in Arrays │ ├── 8.3.1 Sorting in Arrays _ Bubble & Selection Sort.pdf │ ├── README.md │ └── pr_01_selection_sort.cpp └── README.md └── week 2 ├── 4.1 Basic Pattern Questions ├── butterfly_pattern.cpp ├── floyd_triangle.cpp ├── half_pyramid_after_180_rotation.cpp ├── half_pyramid_using_numbers.cpp ├── hollow_rectangle_pattern.cpp ├── inverted_half_pyramid.cpp └── rectangle_pattern.cpp ├── 4.2 Advanced Pattern Questions ├── 4 Pattern Questions.pdf ├── pr_01_inverted_pattern.cpp ├── pr_02_0-1_pattern.cpp ├── pr_03_rhombus_pattern.cpp ├── pr_04_number_pattern.cpp ├── pr_05_palindromic_pattern.cpp ├── pr_06_diamond_patten.cpp ├── pr_07_zig-zag_pattern.cpp ├── pr_08_pascal_traingle.cpp ├── pr_09_pyramid_pattern_for_nos.cpp ├── pr_10_pyramid_pattern_for_nos.cpp ├── pr_11_hollow_rhombus_pattern.cpp └── pr_12_hollow_diamond_pattern.cpp ├── 5.1 Binary Number System ├── .vscode │ └── settings.json ├── 5.1 Binary Number System & Question Practice.pdf ├── pr_01_checking_prime_number.cpp ├── pr_02_positive_decimal_numbers_from_right_to_left.cpp ├── pr_03_factorial.cpp ├── pr_04_armstrong_number.cpp └── pr_05_reversing_number.cpp ├── 5.2 Armstrong, Prime & Reversing Number ├── 5.2 Prime, Armstrong, Reverse a number.pdf ├── pr_01_finding_ASCII_value_of_character.cpp ├── pr_02_displaying_all_factors_of_number.cpp ├── pr_03_finding_factorial.cpp └── pr_04_finding_vowel_or_consonant.cpp ├── 6.1 Functions ├── 6.1 Functions.pdf ├── README.md ├── pr_01_add_2_numbers.cpp └── pr_02_displaying_given_number.cpp ├── 6.2 Functions Challenges ├── .vscode │ └── settings.json ├── 6.2 Functions Problems.pdf ├── pr_01_finding_prime_numbers_between_2_numbers.cpp ├── pr_02_fibonacci.cpp ├── pr_03_factorial.cpp ├── pr_04_finding_nCr.cpp ├── pr_05_pascal.cpp ├── pr_06_finding_even_or_odd_numbers.cpp ├── pr_07_finding_alphabet_or_not.cpp ├── pr_08_find_max_and_min_number.cpp ├── pr_09_swapping_numbers.cpp └── pr_10_using_if-else.cpp ├── 6.3 Advance Functions Questions ├── 6.3 Practice(functions).pdf ├── README.md ├── pr_01_sum_of_n_nos_sol1.cpp ├── pr_01_sum_of_n_nos_sol2.cpp ├── pr_02_checking_pythagorean_triplet.cpp ├── pr_03_binary_to_decimal.cpp ├── pr_04_octal_to_decimal.cpp ├── pr_05_hexadecimal_to_decimal.cpp ├── pr_06_decimal_to_binary.cpp ├── pr_07_decimal_to_octal.cpp ├── pr_08_decimal_to_hexadecimal.cpp └── pr_09_adding_two_binary_numbers.cpp └── README.md /C++ Course.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Apna-College-CPP-Course/8bd0a34920670639800fb48d6609c236e9d861aa/C++ Course.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Apna College CPP Course🔥 2 | 3 | C++ Course 4 | 5 | ## 📌Week 1 6 | 7 | | Content | Tutorial Link | Notes / Practice Set | Code | 8 | | :------- | :-----------: | :-----: | :----: | 9 | | **🔸 1.1 Introduction to C++** | [Link](https://www.youtube.com/watch?v=z9bZufPHFLU&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=1) | [1.1 Lecture Notes](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/Week%201/1.1%20Introduction%20to%20C%2B%2B/1.1%20Lecture%20Notes.pdf) | - | 10 | | **🔸 2.1 Data Types & Type Modifiers** | [Link](https://www.youtube.com/watch?v=cnT1oW5_ePM&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=3) | [2.1 Data Types Notes](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/Week%201/2.1%20Data%20Types%20%26%20Type%20Modifiers/2.1%20Data%20Types%20Notes.pdf) | - | 11 | | **🔸 2.2 Input-Output** | [Link](https://www.youtube.com/watch?v=7dPdMtBX1d8&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=4) | [2.2 Input_Output in c++](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/Week%201/2.2%20Input-Output/2.2%20Input_Output%20in%20c%2B%2B.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/Week%201/2.2%20Input-Output) | 12 | | **🔸 2.3 If-Else Statement** | [Link](https://www.youtube.com/watch?v=cyB3HNlQyjY&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=5) | [2.3 if_else](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/Week%201/2.3%20If-Else%20Statement/2.3%20if_else.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/Week%201/2.3%20If-Else%20Statement) | 13 | | **🔸 2.4 Introduction to Loops** | [Link](https://www.youtube.com/watch?v=IlIn_D1RT7M&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=6) | [2.4 Loops](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/Week%201/2.4%20Introduction%20to%20Loops/2.4%20Loops.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/Week%201/2.4%20Introduction%20to%20Loops) | 14 | | **🔸 3.1 Break and Continue** | [Link](https://www.youtube.com/watch?v=Stf7KBiA1vs&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=7) | [3.1 Jumps in loops](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/Week%201/3.1%20Break%20and%20Continue/3.1%20Jumpsinloops.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/Week%201/3.1%20Break%20and%20Continue) | 15 | | **🔸 3.2 Switch Case Statement** | [Link](https://www.youtube.com/watch?v=G80-j_xnE_8&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=8) | [3.2 Switch Case Statement](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/Week%201/3.2%20Switch%20Case%20Statement/3.2%20Switch-Case%20statement.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/Week%201/3.2%20Switch%20Case%20Statement) | 16 | | **🔸 3.3 Operators in C++** | [Link](https://www.youtube.com/watch?v=JBgZxnAj4hg&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=9) | [3.3 Operators](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/Week%201/3.3%20Operators%20in%20C%2B%2B/3.3%20Operators.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/Week%201/3.3%20Operators%20in%20C%2B%2B) | 17 | 18 | 19 | ## 📌Week 2 20 | 21 | | Content | Tutorial Link | Notes / Practice Set | Code | 22 | | :------- | :-----------: | :-----: | :----: | 23 | | **🔸 4.1 Basic Pattern Questions** | [Link](https://www.youtube.com/watch?v=LfgAOZ1kKMw&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=10) | - | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/week%202/4.1%20Basic%20Pattern%20Questions) | 24 | | **🔸 4.2 Advanced Pattern Questions** | [Link](https://www.youtube.com/watch?v=k9OlCJFy5yo&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=11) | [4.2 Pattern Questions](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/week%202/4.2%20Advanced%20Pattern%20Questions/4%20Pattern%20Questions.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/week%202/4.2%20Advanced%20Pattern%20Questions) | 25 | | **🔸 5.1 Binary Number System** | [Link](https://www.youtube.com/watch?v=QIyugGzih4k&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=12) | [5.1 Binary Number System](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/week%202/5.1%20Binary%20Number%20System/5.1%20Binary%20Number%20System%20%26%20Question%20Practice.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/week%202/5.1%20Binary%20Number%20System) | 26 | | **🔸 5.2 Armstrong, Prime & Reversing Number** | [Link](https://www.youtube.com/watch?v=6TzUHrAXytM&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=13) | [5.2 Prime, Armstrong, Reverse a number](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/week%202/5.2%20Armstrong%2C%20Prime%20%26%20Reversing%20Number/5.2%20Prime%2C%20Armstrong%2C%20Reverse%20a%20number.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/week%202/5.2%20Armstrong%2C%20Prime%20%26%20Reversing%20Number) | 27 | | **🔸 6.1 Functions** | [Link](https://www.youtube.com/watch?v=83KtncYgHYQ&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=14) | [6.1 Functions](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/week%202/6.1%20Functions/6.1%20Functions.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/week%202/6.1%20Functions) | 28 | | **🔸 6.2 Functions Challenges** | [Link](https://www.youtube.com/watch?v=8vzk_JBKGcQ&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=15) | [6.2 Functions Challenges](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/week%202/6.2%20Functions%20Challenges/6.2%20Functions%20Problems.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/week%202/6.2%20Functions%20Challenges) | 29 | | **🔸 6.3 Advance Functions Questions** | [Link](https://www.youtube.com/watch?v=lYnPK1svd-4&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=16) | [6.3 Advance Functions Questions](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/week%202/6.3%20Advance%20Functions%20Questions/6.3%20Practice(functions).pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/week%202/6.3%20Advance%20Functions%20Questions) | 30 | 31 | 32 | ## 📌Week 3 33 | 34 | | Content | Tutorial Link | Notes / Practice Set | Code | 35 | | :------- | :-----------: | :-----: | :----: | 36 | | **🔸 7.1 Time Complexity** | [Link](https://www.youtube.com/watch?v=rq_rwnveh8s&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=17) | [7.1 Time Complexity](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/Week%203/7.1%20Time%20Complexity/7.1%20Time%20Complexity.pdf) | - | 37 | | **🔸 8.1 Introduction To Arrays** | [Link](https://www.youtube.com/watch?v=PyTK_g1l8V8&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=18) | [8.1 Introduction To Arrays](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/Week%203/8.1%20Introduction%20To%20Arrays/8.1%20Arrays.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/Week%203/8.1%20Introduction%20To%20Arrays) | 38 | | **🔸 8.2 Searching in Arrayss** | [Link](https://www.youtube.com/watch?v=13ocRMSJy5M&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=19) | - | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/Week%203/8.2%20Searching%20in%20Arrays) | 39 | | **🔸 8.3.1 Sorting in Arrays** | [Link](https://www.youtube.com/watch?v=dQa4A2Z0_Ro&list=PLfqMhTWNBTe0b2nM6JHVCnAkhQRGiZMSJ&index=20) | [8.3.1 Sorting in Arrays](https://github.com/kishanrajput23/Apna-College-CPP-Course/blob/main/Week%203/8.3.1%20Sorting%20in%20Arrays/8.3.1%20Sorting%20in%20Arrays%20_%20Bubble%20%26%20Selection%20Sort.pdf) | [Code](https://github.com/kishanrajput23/Apna-College-CPP-Course/tree/main/Week%203/8.3.1%20Sorting%20in%20Arrays) | 40 | -------------------------------------------------------------------------------- /Timeline/Timeline of C++ Course.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Apna-College-CPP-Course/8bd0a34920670639800fb48d6609c236e9d861aa/Timeline/Timeline of C++ Course.pdf -------------------------------------------------------------------------------- /Week 1/.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Win32", 5 | "includePath": [ 6 | "${workspaceFolder}/**" 7 | ], 8 | "defines": [ 9 | "_DEBUG", 10 | "UNICODE", 11 | "_UNICODE" 12 | ], 13 | "cStandard": "c17", 14 | "cppStandard": "c++17", 15 | "intelliSenseMode": "gcc-x64" 16 | } 17 | ], 18 | "version": 4 19 | } -------------------------------------------------------------------------------- /Week 1/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "iostream": "cpp" 4 | } 5 | } -------------------------------------------------------------------------------- /Week 1/1.1 Introduction to C++/1.1 Lecture Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Apna-College-CPP-Course/8bd0a34920670639800fb48d6609c236e9d861aa/Week 1/1.1 Introduction to C++/1.1 Lecture Notes.pdf -------------------------------------------------------------------------------- /Week 1/2.1 Data Types & Type Modifiers/2.1 Data Types Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Apna-College-CPP-Course/8bd0a34920670639800fb48d6609c236e9d861aa/Week 1/2.1 Data Types & Type Modifiers/2.1 Data Types Notes.pdf -------------------------------------------------------------------------------- /Week 1/2.2 Input-Output/2.2 Input_Output in c++.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Apna-College-CPP-Course/8bd0a34920670639800fb48d6609c236e9d861aa/Week 1/2.2 Input-Output/2.2 Input_Output in c++.pdf -------------------------------------------------------------------------------- /Week 1/2.2 Input-Output/hello_guys.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | cout<<"Hello Guys Let's get started this course"< 2 | using namespace std; 3 | int main() 4 | { 5 | cout<<"Hello World"< 2 | using namespace std; 3 | int main() { 4 | int a; 5 | int b; 6 | cin>>a>>b; 7 | 8 | if (a==b) { 9 | cout<<"Both numbers are equal"< 2 | using namespace std; 3 | int main() { 4 | int x; 5 | int y; 6 | cin>>x>>y; 7 | 8 | if(x==y) { 9 | cout<<"Both numbers are equal"<y) { 12 | cout<<"X is greater than Y"< 2 | using namespace std; 3 | 4 | int main() { 5 | int n; 6 | cin>>n; 7 | if (n%2==0) { 8 | cout< 2 | using namespace std; 3 | int main() { 4 | int age; 5 | cin>>age; 6 | 7 | if(age >= 18) { 8 | cout<<"You are adult now!!"< 2 | using namespace std; 3 | int main() { 4 | int x; 5 | int y; 6 | cin>>x>>y; 7 | 8 | if(x==y) { 9 | cout<<"Both numbers are equal"<y){ 13 | cout<<"x is greater than y"< 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cout<<"Enter a number"<>n; 7 | if (n%2==0) { 8 | cout<<"The number is even"< 2 | using namespace std; 3 | int main() { 4 | int k; 5 | cout<<"Enter the number you want to create a table"<>k; 7 | for(int i=1;i<=10;i++) { 8 | cout< 2 | using namespace std; 3 | int main() { 4 | int i=1; 5 | 6 | while(i<=5) { 7 | cout< 2 | using namespace std; 3 | int main() { 4 | int number; 5 | int sum=0; 6 | cout<<"Enter a number"<>number; 8 | while(number>=0) { 9 | sum+= number; 10 | cout<<"Enter a number"<>number; 12 | } 13 | cout<<"The sum is "< 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cout<<"Enter the number till you want to print sum"<>n; 7 | int sum=0; 8 | 9 | for(int i=0;i<=n;i++) { 10 | sum = sum + i; 11 | } 12 | cout<<"sum is "< 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cout<<"Enter a number"<>n; 7 | int i; 8 | for(i=2; i 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cout<<"Enter a number"<>n; 7 | for(int i=0; i<=n; i++) { 8 | if (i%2==0) { 9 | continue; 10 | } 11 | cout< 2 | using namespace std; 3 | int main() { 4 | int a,b; 5 | cout<<"Enter 2 numbers"<>a>>b; 7 | for(int i=a; i<=b; i++) { 8 | int j; 9 | for (j=2; j 2 | using namespace std; 3 | int main() { 4 | char alphabet; 5 | 6 | cout<<"Enter an alphabet"<>alphabet; 8 | 9 | switch (alphabet) 10 | { 11 | case 'a': 12 | cout<<"It is a vowel"< 2 | using namespace std; 3 | int main() { 4 | int a,b; 5 | char op; 6 | 7 | cout<<"Enter two numbers"<>a>>b; 9 | 10 | cout<<"Enter a opeator"<>op; 12 | 13 | switch (op) 14 | { 15 | case '+': 16 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | int i=1; 6 | //1 + 3 7 | i = i++ + ++i; 8 | 9 | cout< 2 | using namespace std; 3 | int main() { 4 | int i=1; 5 | int j=2; 6 | int k; 7 | // 1 2 1 2 3 4 8 | k = i + j + i++ + j++ + ++i + ++j; 9 | 10 | cout< 2 | using namespace std; 3 | int main() { 4 | int i=0; 5 | // 0 0 1 1 6 | i = i++ - --i + ++i - i--; 7 | 8 | cout< 2 | using namespace std; 3 | int main() { 4 | int i=1, j=2, k=3; 5 | // 1 2 3 6 | int m = i-- - j-- - k--; 7 | 8 | cout< 2 | using namespace std; 3 | int main() { 4 | int i=10, j=20, k; 5 | //10 9 19 20 9 20 10 19 6 | k = i-- - i++ + --j - ++j + --i - j-- + ++i - j++; 7 | 8 | cout< 2 | using namespace std; 3 | int main() { 4 | int a=5; 5 | 6 | a=1,2,3; 7 | 8 | cout< 2 | using namespace std; 3 | int main() { 4 | int a; 5 | a=(1,2,3); 6 | cout< 2 | using namespace std; 3 | int main() { 4 | 5 | int x=2; 6 | 7 | (x&1) ? cout<<"true":cout<<"false"< 2 | using namespace std; 3 | int main() { 4 | 5 | int a=1, b=3, c; 6 | c=b< 2 | using namespace std; 3 | int main() { 4 | int a=4; 5 | int b=5; 6 | int c = a>b? a-b:b-a; 7 | 8 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | int array[4] = {10,20,30,40}; 6 | 7 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | int n; 6 | cin>>n; 7 | 8 | int array[n]; 9 | 10 | for (int i=0; i>array[i]; 12 | } 13 | 14 | for (int i=0; i 2 | #include 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin>>n; 8 | 9 | int array[n]; 10 | 11 | for (int i=0; i>array[i]; 13 | } 14 | 15 | int maxNo = INT_MIN; 16 | int minNo = INT_MAX; 17 | 18 | for (int i=0; i 2 | using namespace std; 3 | 4 | int linearSearch(int arr[], int n, int key) { 5 | for (int i=0; i>n; 17 | 18 | int arr[n]; 19 | 20 | for (int i=0; i>arr[i]; 22 | } 23 | 24 | int key; 25 | cin>>key; 26 | 27 | cout< 2 | using namespace std; 3 | 4 | int binarySearch(int arr[], int n, int key) { 5 | int start=0; 6 | int end=n-1; 7 | 8 | while(start<=end) { 9 | int mid = (start+end)/2; 10 | 11 | if (arr[mid]==key) { 12 | return mid; 13 | } 14 | else if (arr[mid]>key){ 15 | end = mid-1; 16 | } 17 | else { 18 | start = mid+1; 19 | } 20 | } 21 | return -1; 22 | } 23 | 24 | int main() { 25 | 26 | int n; 27 | cin>>n; 28 | 29 | int arr[n]; 30 | 31 | for (int i=0; i>arr[i]; 33 | } 34 | 35 | int key; 36 | cin>>key; 37 | 38 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | int arr[n]; 10 | for (int i=0; i>arr[i]; 12 | } 13 | 14 | for (int i=0; i 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin>>n; 6 | 7 | for(int i=1;i<=n;i++) { 8 | for(int j=1;j<=i;j++) { 9 | cout<<"* "; 10 | } 11 | int space = 2*n - 2*i; 12 | for(int j=1;j<=space;j++) { 13 | cout<<" "; 14 | } 15 | for(int j=1;j<=i;j++) { 16 | cout<<"* "; 17 | } 18 | cout<=1;i--) { 22 | for(int j=1;j<=i;j++) { 23 | cout<<"* "; 24 | } 25 | int space = 2*n - 2*i; 26 | for(int j=1;j<=space;j++) { 27 | cout<<" "; 28 | } 29 | for(int j=1;j<=i;j++) { 30 | cout<<"* "; 31 | } 32 | cout< 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin>>n; 6 | 7 | int count=1; 8 | for(int i=1;i<=n;i++) { 9 | for(int j=1;j<=i;j++) { 10 | cout< 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin>>n; 6 | for(int i=1;i<=n;i++) { 7 | for(int j=1;j<=n;j++) { 8 | if (j<=n-i) { 9 | cout<<" "; 10 | } 11 | else { 12 | cout<<"* "; 13 | } 14 | } 15 | cout< 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin>>n; 6 | for(int i=1;i<=n;i++) { 7 | for(int j=1;j<=i;j++) { 8 | cout< 2 | using namespace std; 3 | int main() { 4 | int row, col; 5 | cin>>row>>col; 6 | for(int i=1;i<=row;i++) { 7 | for(int j=1;j<=col;j++) { 8 | if (i==1 || i==row) { 9 | cout<<"* "; 10 | } 11 | else if(j==1 || j==col) { 12 | cout<<"* "; 13 | } 14 | else { 15 | cout<<" "; 16 | } 17 | } 18 | cout< 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin>>n; 6 | for(int i=n;i>=1;i--) { 7 | for(int j=1;j<=i;j++) { 8 | cout<<"* "; 9 | } 10 | cout< 2 | using namespace std; 3 | int main() { 4 | int row, col; 5 | cin>>row>>col; 6 | for(int i=1;i<=row;i++) { 7 | for(int j=1;j<=col;j++) { 8 | cout<<"* "; 9 | } 10 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | int n; 6 | cin>>n; 7 | 8 | for (int i=1; i<=n; i++) { 9 | for (int j=1; j<=n+1-i; j++) { 10 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | for (int i=1; i<=n; i++) { 10 | for (int j=1; j<=i; j++) { 11 | if ((i+j) % 2 == 0) { 12 | cout<<"1"<<" "; 13 | } 14 | else { 15 | cout<<"0"<<" "; 16 | } 17 | } 18 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | for (int i=1; i<=n; i++) { 10 | for (int j=1; j<=n-i; j++) { 11 | cout<<" "; 12 | } 13 | for (int j=1; j<=n; j++) { 14 | cout<<"* "; 15 | } 16 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | for (int i=1; i<=n; i++) { 10 | for (int j=1; j<=n-i; j++) { 11 | cout<<" "; 12 | } 13 | for (int j=1; j<=i; j++) { 14 | cout< 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | 7 | int n; 8 | cin>>n; 9 | 10 | for(int i=1; i<=n; i++) { 11 | int j; 12 | for(j=1; j<=n-i; j++) { 13 | cout<<" "; 14 | } 15 | int k=i; 16 | for(;j<=n; j++) { 17 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | for(int i=1; i<=n; i++) { 10 | for(int j=1; j<=n-i; j++) { 11 | cout<<" "; 12 | } 13 | for(int j=1; j<=2*i-1; j++) { 14 | cout<<"*"; 15 | } 16 | cout<=1; i--) { 20 | for(int j=1; j<=n-i; j++) { 21 | cout<<" "; 22 | } 23 | for(int j=1; j<=2*i-1; j++) { 24 | cout<<"*"; 25 | } 26 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | int r = 3; 10 | 11 | for(int i=1; i<=r; i++) { 12 | for(int j=1; j<=n; j++) { 13 | if ((i+j) % 4 == 0) { 14 | cout<<"* "; 15 | } 16 | 17 | else if (i==2 and j%4==0) { 18 | cout<<"* "; 19 | } 20 | else { 21 | cout<<" "; 22 | } 23 | } 24 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | int coef=1; 10 | 11 | for(int i=0; i 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | for (int i=1; i<=n; i++) { 10 | for (int j=1; j<=n-i; j++) { 11 | cout<<" "; 12 | } 13 | for (int j=1; j<=i; j++) { 14 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | for (int i=1; i<=n; i++) { 10 | for (int j=1; j<=n-i; j++) { 11 | cout<<" "; 12 | } 13 | for (int j=1; j<=i; j++) { 14 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | for (int i=1; i<=n; i++) { 10 | for (int j=1; j<=n-i; j++) { 11 | cout<<" "; 12 | } 13 | for (int j=1; j<=n; j++) { 14 | if (i==1 || i==n || j==1 || j==n) { 15 | cout<<"* "; 16 | } 17 | else { 18 | cout<<" "; 19 | } 20 | } 21 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | for(int i=1; i<=n; i++) { 10 | for(int j=1; j<=n-i; j++) { 11 | cout<<" "; 12 | } 13 | for(int j=1; j<=2*i-1; j++) { 14 | if (j==1 || j==2*i-1) { 15 | cout<<"*"; 16 | } 17 | else { 18 | cout<<" "; 19 | } 20 | } 21 | cout<=1; i--) { 25 | for(int j=1; j<=n-i; j++) { 26 | cout<<" "; 27 | } 28 | for(int j=1; j<=2*i-1; j++) { 29 | if (j==1 || j==2*i-1) { 30 | cout<<"*"; 31 | } 32 | else { 33 | cout<<" "; 34 | } 35 | } 36 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | bool flag=true; 10 | 11 | for (int i=2; i*i<=n; i++) { 12 | if (n%i==0) { 13 | flag=false; 14 | break; 15 | } 16 | } 17 | if (n<=1) { 18 | flag=false; 19 | } 20 | 21 | if (flag) { 22 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | while (n>0) { 10 | int rem = n % 10; 11 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | int num=1; 10 | 11 | for (int i=1; i<=n; i++) { 12 | num = num * i; 13 | } 14 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | int sum = 0; 10 | int org_sum = n; 11 | 12 | while(n>0) { 13 | int rem = n % 10; 14 | 15 | sum = sum + rem * rem * rem; 16 | 17 | n = n / 10; 18 | } 19 | if (org_sum == sum) { 20 | cout<<"The number is an armstrong number."; 21 | } 22 | else { 23 | cout<<"The number is not an armstrong number."; 24 | } 25 | return 0; 26 | } -------------------------------------------------------------------------------- /week 2/5.1 Binary Number System/pr_05_reversing_number.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cin>>n; 8 | 9 | int rev_num = 0; 10 | 11 | while (n>0) { 12 | int rem = n % 10; 13 | rev_num = rev_num * 10 + rem; 14 | n = n / 10; 15 | } 16 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | char c; 7 | cin>>c; 8 | 9 | cout<<"The ASCII value of "< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cout << "Enter the number to determine its factors : " << endl; 8 | cin>>n; 9 | 10 | cout<<"The factors are :"< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | cout<<"Enter the number to find its factorial "<>n; 9 | 10 | int fact = 1; 11 | 12 | for (int i=1; i<=n; i++) { 13 | fact *= i; 14 | } 15 | cout<<"The factorial of "< 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | char c; 7 | 8 | cout<<"Enter any character "<>c; 11 | 12 | if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U') { 13 | cout< 2 | using namespace std; 3 | 4 | int add(int num1, int num2) { 5 | int sum = num1 + num2; 6 | return sum; 7 | } 8 | 9 | int main() { 10 | 11 | int a, b; 12 | cin>>a; 13 | cin>>b; 14 | 15 | cout< 2 | using namespace std; 3 | 4 | void display(int num) { 5 | cout<>num; 13 | 14 | cout< 2 | #include 3 | using namespace std; 4 | 5 | bool isPrime(int num) { 6 | for (int i=2; i<=sqrt(num); i++) { 7 | if (num % i == 0) { 8 | return false; 9 | } 10 | } 11 | return true; 12 | } 13 | 14 | int main() { 15 | int a; 16 | int b; 17 | cin>>a; 18 | cin>>b; 19 | 20 | for (int i=a; i<=b; i++) { 21 | if (isPrime(i)) { 22 | cout< 2 | using namespace std; 3 | 4 | void fib(int n) { 5 | int t1 = 0; 6 | int t2 = 1; 7 | int nextTerm; 8 | 9 | for (int i=1; i<=n; i++) { 10 | cout<>n; 22 | 23 | fib(n); 24 | 25 | return 0; 26 | } -------------------------------------------------------------------------------- /week 2/6.2 Functions Challenges/pr_03_factorial.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int fact(int num) { 5 | int factorial = 1; 6 | for (int i=1; i<=num; i++) { 7 | factorial *= i; 8 | } 9 | return factorial; 10 | } 11 | 12 | int main() { 13 | 14 | int num; 15 | cin>>num; 16 | 17 | int ans = fact(num); 18 | 19 | cout< 2 | using namespace std; 3 | 4 | int fact(int num) { 5 | int factorial = 1; 6 | for (int i=1; i<=num; i++) { 7 | factorial *= i; 8 | } 9 | return factorial; 10 | } 11 | 12 | int main() { 13 | 14 | int n, r; 15 | cin>>n>>r; 16 | 17 | int ans = fact(n) / ( fact(n-r) * fact(r) ); 18 | 19 | cout< 2 | using namespace std; 3 | 4 | int fact(int num) { 5 | int factorial = 1; 6 | for (int i=1; i<=num; i++) { 7 | factorial *= i; 8 | } 9 | return factorial; 10 | } 11 | 12 | int main() { 13 | 14 | int n; 15 | cin>>n; 16 | 17 | for (int i=0; i<=n; i++) { 18 | for (int j=0; j<=i; j++) { 19 | cout< 2 | using namespace std; 3 | 4 | bool evenOdd(int n) { 5 | if (n%2==0) { 6 | return true; 7 | } 8 | else { 9 | return false; 10 | } 11 | } 12 | 13 | int main() { 14 | int n; 15 | cin>>n; 16 | 17 | if (evenOdd(n)) { 18 | cout<<"Number is Even"; 19 | } 20 | else { 21 | cout<<"Number is Odd"; 22 | } 23 | return 0; 24 | } -------------------------------------------------------------------------------- /week 2/6.2 Functions Challenges/pr_07_finding_alphabet_or_not.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | bool isAplphabet(char ch) { 5 | if (ch>='a' && ch<='z' || ch>='A' && ch<='Z') { 6 | return true; 7 | } 8 | else { 9 | return false; 10 | } 11 | } 12 | 13 | int main() { 14 | char ch; 15 | cout<<"Enter a character: "; 16 | cin>>ch; 17 | 18 | if (isAplphabet(ch)) { 19 | cout< 2 | using namespace std; 3 | 4 | int maxNum(int a, int b, int c) { 5 | if (a>b) { 6 | if (a>c) { 7 | return a; 8 | } 9 | else { 10 | return c; 11 | } 12 | } 13 | else { 14 | if (b>c) { 15 | return b; 16 | } 17 | else { 18 | return c; 19 | } 20 | } 21 | } 22 | 23 | int minNum(int a, int b, int c) { 24 | if (a>a; 47 | cout<<"Enter second number"<>b; 49 | cout<<"Enter third number"<>c; 51 | 52 | int max_num = maxNum(a, b, c); 53 | int min_num = minNum(a, b, c); 54 | 55 | cout<<"The Maximum number is "< 2 | using namespace std; 3 | 4 | void swap(int ,int ); 5 | /*Swapping of Two Numbers in C++ Using Functions Call by Value*/ 6 | int main() 7 | { 8 | int a,b; 9 | cout<<"Enter the Two Numbers to Swap in C++: "; 10 | cin>>a>>b; 11 | cout<<"\nAfter Swapping of Two Numbers:"; 12 | swap(a,b); 13 | 14 | return 0; 15 | } 16 | void swap(int x,int y) 17 | { 18 | int z; 19 | /*Extra variable for storing the value of first or second variable*/ 20 | 21 | z=x; 22 | /*Copying the first variable value to the tempriory variable*/ 23 | x=y; 24 | /*Copying the second variable value to the first variable*/ 25 | y=z; 26 | /*Copying the tempriory variable value to the second variable*/ 27 | cout<<" "< 2 | using namespace std; 3 | 4 | bool isEligible(int age) { 5 | if (age>= 18) { 6 | return true; 7 | } 8 | else { 9 | return false; 10 | } 11 | } 12 | 13 | int main() { 14 | int age; 15 | cout<<"Enter your age "<>age; 17 | 18 | if (isEligible(age)) { 19 | cout<<"You are eligible for voting"; 20 | } 21 | else { 22 | cout<<"You are not eligible for voting"; 23 | } 24 | return 0; 25 | } -------------------------------------------------------------------------------- /week 2/6.3 Advance Functions Questions/6.3 Practice(functions).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Apna-College-CPP-Course/8bd0a34920670639800fb48d6609c236e9d861aa/week 2/6.3 Advance Functions Questions/6.3 Practice(functions).pdf -------------------------------------------------------------------------------- /week 2/6.3 Advance Functions Questions/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Apna-College-CPP-Course/8bd0a34920670639800fb48d6609c236e9d861aa/week 2/6.3 Advance Functions Questions/README.md -------------------------------------------------------------------------------- /week 2/6.3 Advance Functions Questions/pr_01_sum_of_n_nos_sol1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | 5 | int sum(int n) { 6 | int ans = 0; 7 | for (int i=0; i<=n; i++) { 8 | ans += i; 9 | } 10 | return ans; 11 | } 12 | 13 | 14 | int main() { 15 | int n; 16 | cin>>n; 17 | 18 | cout< 2 | using namespace std; 3 | 4 | 5 | int sum(int n) { 6 | int ans = n * (n+1) / 2; 7 | return ans; 8 | } 9 | 10 | 11 | int main() { 12 | int n; 13 | cin>>n; 14 | 15 | cout< 2 | using namespace std; 3 | 4 | bool isPythagorean(int x, int y, int z) { 5 | int a = max(x, max(y, z)); 6 | int b,c; 7 | if (a==x) { 8 | b=y; 9 | c=z; 10 | } 11 | 12 | else if (a==y) { 13 | b=x; 14 | c=z; 15 | } 16 | else { 17 | b=x; 18 | c=y; 19 | } 20 | 21 | if (a*a == b*b + c*c) { 22 | return true; 23 | } 24 | else { 25 | return false; 26 | } 27 | } 28 | 29 | int main() { 30 | int x,y,z; 31 | cin>>x>>y>>z; 32 | 33 | if (isPythagorean(x,y,z)) { 34 | cout<<"It is Pythagorean Triplet"; 35 | } 36 | else { 37 | cout<<"It is not Pythagorean Triplet"; 38 | } 39 | return 0; 40 | } -------------------------------------------------------------------------------- /week 2/6.3 Advance Functions Questions/pr_03_binary_to_decimal.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int binaryTodecimal(int n) { 5 | int ans = 0; 6 | 7 | int x=1; 8 | 9 | while (n>0) { 10 | int y = n%10; 11 | ans += x*y; 12 | x *= 2; 13 | n/=10; 14 | } 15 | return ans; 16 | } 17 | 18 | int main() { 19 | int n; 20 | cin>>n; 21 | 22 | cout< 2 | using namespace std; 3 | 4 | int octalTodecimal(int n) { 5 | int ans = 0; 6 | 7 | int x=1; 8 | 9 | while (n>0) { 10 | int y = n%10; 11 | ans += x*y; 12 | x *= 8; 13 | n/=10; 14 | } 15 | return ans; 16 | } 17 | 18 | int main() { 19 | int n; 20 | cin>>n; 21 | 22 | cout< 2 | using namespace std; 3 | 4 | int hexadecimalToDecimal(string n) { 5 | 6 | int ans = 0; 7 | int x=1; 8 | 9 | int s = n.size(); 10 | 11 | for (int i=s-1; i>=0; i--) { 12 | if (n[i] >= '0' && n[i] <= '9') { 13 | ans += x * (n[i] - '0'); 14 | } 15 | else if (n[i] >= 'A' && n[i] <= 'F'){ 16 | ans += x * (n[i] - 'A' + 10); 17 | } 18 | x *= 16; 19 | } 20 | return ans; 21 | } 22 | 23 | int main() { 24 | string n; 25 | 26 | cin>>n; 27 | 28 | cout< 2 | using namespace std; 3 | 4 | int decimalToBinary(int n) { 5 | int x=1; 6 | int ans=0; 7 | 8 | while (x<=n) 9 | x *= 2; 10 | x/=2; 11 | 12 | 13 | while (x>0) { 14 | int lastDigit = n/x; 15 | n -= lastDigit*x; 16 | x/=2; 17 | ans = ans*10 + lastDigit; 18 | } 19 | return ans; 20 | } 21 | 22 | int main() { 23 | int n; 24 | 25 | cin>>n; 26 | 27 | cout< 2 | using namespace std; 3 | 4 | int decimalToOctal(int n) { 5 | int x=1; 6 | int ans=0; 7 | 8 | while (x<=n) 9 | x *= 8; 10 | x/=8; 11 | 12 | 13 | while (x>0) { 14 | int lastDigit = n/x; 15 | n -= lastDigit*x; 16 | x/=8; 17 | ans = ans*10 + lastDigit; 18 | } 19 | return ans; 20 | } 21 | 22 | int main() { 23 | int n; 24 | 25 | cin>>n; 26 | 27 | cout< 2 | using namespace std; 3 | 4 | string decimalToHexadecimal(int n) { 5 | int x=1; 6 | string ans=""; 7 | 8 | while (x<=n) 9 | x *= 16; 10 | x/=16; 11 | 12 | 13 | while (x>0) { 14 | int lastDigit = n/x; 15 | n -= lastDigit*x; 16 | x/=16; 17 | if (lastDigit <= 9) { 18 | ans = ans + to_string(lastDigit); 19 | } 20 | else { 21 | char c = 'A' + lastDigit - 10; 22 | ans.push_back(c); 23 | } 24 | } 25 | return ans; 26 | } 27 | 28 | int main() { 29 | int n; 30 | 31 | cin>>n; 32 | 33 | cout< 2 | using namespace std; 3 | 4 | int reverse(int n) { 5 | int ans = 0; 6 | while (n>0) { 7 | int lastDigit = n%10; 8 | ans = ans*10 +lastDigit; 9 | n /= 10; 10 | } 11 | return ans; 12 | } 13 | 14 | 15 | int addBinary(int a, int b) { 16 | int ans = 0; 17 | int prevCarry = 0; 18 | while (a > 0 && b > 0) { 19 | if (a%2 == 0 && b%2 ==0) { 20 | ans = ans*10 + prevCarry; 21 | prevCarry = 0; 22 | } 23 | else if ((a%2 == 0 && b%2 == 1) || (a%2 == 1 && b%2 == 0)) { 24 | if (prevCarry = 1) { 25 | ans = ans*10 + 0; 26 | prevCarry = 1; 27 | } 28 | else { 29 | ans = ans*10 + 1; 30 | prevCarry = 0; 31 | } 32 | } 33 | else { 34 | ans = ans*10 + prevCarry; 35 | prevCarry = 1; 36 | } 37 | a /= 10; 38 | b /= 10; 39 | } 40 | while (a>0) { 41 | if (prevCarry == 1) { 42 | if (a%2 == 1) { 43 | ans = ans*10 + 0; 44 | prevCarry = 1; 45 | } 46 | else { 47 | ans = ans*10 + 1; 48 | prevCarry = 0; 49 | } 50 | } 51 | else 52 | ans = ans*10 + (a%2); 53 | a /= 10; 54 | } 55 | 56 | while (b>0) { 57 | if (prevCarry == 1) { 58 | if (b%2 == 1) { 59 | ans = ans*10 + 0; 60 | prevCarry = 1; 61 | } 62 | else { 63 | ans = ans*10 + 1; 64 | prevCarry = 0; 65 | } 66 | } 67 | else 68 | ans = ans*10 + (a%2); 69 | b /= 10; 70 | } 71 | 72 | if (prevCarry == 1) { 73 | ans = ans*10 + 1; 74 | } 75 | ans = reverse(ans); 76 | return ans; 77 | } 78 | 79 | int main() { 80 | int a,b; 81 | 82 | cin>>a>>b; 83 | 84 | cout<