├── .github └── FUNDING.yml ├── .vscode └── c_cpp_properties.json ├── C++ ├── Binary Search By Suraj.cpp ├── ComparingTwoFractions.cpp ├── Connected_components.cpp ├── Counting_sort.cpp ├── Dijkstra’s shortest path algorithm by Suraj.cpp ├── Heap sort by suraj.cpp ├── Kadanes_Algorithm.cpp ├── Knapsack Problem by Suraj.cpp ├── Merge_sort.cpp ├── Pow.cpp ├── Power_of_2.cpp ├── Reverse_integer.cpp ├── Rock, Paper and Scissors Game By Suraj.cpp ├── Search in Rotated Sorted Matrix ├── Search_a_2D_Matrix.cpp ├── Tower of Hanoi By Suraj.cpp ├── Transpose Of Matrix.cpp ├── Trie.cpp ├── XOR LL.cpp ├── bucketSort.cpp ├── create_segment_tree.cpp ├── divisible_subarrays_using_pigeon_hole_principle.cpp ├── factorial.cpp ├── factorialprogram.cpp ├── intersection-of-two-linked-lists.cpp ├── kmp_algotihm.cpp ├── main.cpp ├── pattern.cpp ├── square pattern in cpp.cpp └── starpattern.cpp ├── C ├── Bernoulli Probability.c ├── BubbleSort.c ├── Star Pattern 1 in C.c ├── Taylor Series.c ├── dsa_polynomial_Parnani.c ├── main.c ├── print ip address and hostname.c ├── selection_sort.c ├── square pattern in c.c └── stack_arr.c ├── CONTRIBUTORS.md ├── Dart └── numbers.dart ├── Game ├── Rock_Paper_Scissors │ ├── index.html │ ├── paper.jpg │ ├── rock.png │ ├── scissors.png │ ├── script.js │ └── style.css └── game.txt ├── HTML ├── index.html └── navbar.html ├── Java ├── CodeChef │ └── q1.java ├── CountingTheNumberOfPathsToReachFrom1ToN.java ├── InsertionSort.java ├── OccurenceOfCharInString.java ├── QuickSort.java ├── convert-Binary_Tree-to-Binary_Search_Tree │ └── InnocentDaksh63.java └── main.java ├── Javascript ├── main.js └── print 1 to 100 without numbers.js ├── LICENSE ├── PHP ├── main.php └── stringReverser.php ├── Python ├── BlackjackCapstoneGame.py ├── Calculator without operators.py ├── GUI_calculator.py ├── Numberpattern.py ├── Print 1 to 100 without numbers.py ├── QuickSort.py ├── RadixSort.py ├── Steganography.py ├── character_pattern.py ├── checkpass.py ├── common_factor.py ├── hangman.py ├── hourglass_pattern.py ├── loading_on_python.py ├── main.py ├── number guesser game.py ├── print 1 to 100 without numbers.py ├── snakegame.py ├── starpattern.py ├── tic_tac_toe_game.py ├── webp to png.py └── words.py └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: ['AdarshAddee'] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.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 | "compilerPath": "D:\\MinGW\\bin\\gcc.exe", 14 | "cStandard": "gnu17", 15 | "cppStandard": "gnu++14", 16 | "intelliSenseMode": "windows-gcc-x86" 17 | } 18 | ], 19 | "version": 4 20 | } -------------------------------------------------------------------------------- /C++/Binary Search By Suraj.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int binarySearch(int arr[], int left, int right, int x) { 5 | while (left <= right) { 6 | int mid = left + (right - left) / 2; 7 | 8 | if (arr[mid] == x) { 9 | return mid; 10 | } else if (arr[mid] < x) { 11 | left = mid + 1; 12 | } else { 13 | right = mid - 1; 14 | } 15 | } 16 | 17 | return -1; 18 | } 19 | 20 | int main() { 21 | int myarr[10]; 22 | int num; 23 | int output; 24 | 25 | cout << "Please enter 10 elements ASCENDING order" << endl; 26 | for (int i = 0; i < 10; i++) { 27 | cin >> myarr[i]; 28 | } 29 | cout << "Please enter an element to search" << endl; 30 | cin >> num; 31 | 32 | output = binarySearch(myarr, 0, 9, num); 33 | 34 | if (output == -1) { 35 | cout << "No Match Found" << endl; 36 | } else { 37 | cout << "Match found at position: " << output << endl; 38 | } 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /C++/ComparingTwoFractions.cpp: -------------------------------------------------------------------------------- 1 | // fikriks 2 | 3 | #include 4 | 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | int pecahan_pembilang1, pecahan_penyebut1, pecahan_pembilang2, pecahan_penyebut2; 10 | float hasil1, hasil2; 11 | 12 | printf("%s\n", "Membandingkan Dua Bilangan Pecahan"); 13 | printf("Masukan Bilangan Pecahan Ke-1 (Format Input = 1/2) = "); 14 | scanf("%i/%i", &pecahan_pembilang1, &pecahan_penyebut1); 15 | 16 | printf("Masukan Bilangan Pecahan Ke-2 (Format Input = 1/2) = "); 17 | scanf("%i/%i", &pecahan_pembilang2, &pecahan_penyebut2); 18 | 19 | hasil1 = (float) pecahan_pembilang1 / pecahan_penyebut1; 20 | hasil2 = (float) pecahan_pembilang2 / pecahan_penyebut2; 21 | 22 | if(hasil1 == hasil2){ 23 | printf("Pecahan Ke-1 (%i/%i) Sama Dengan Pecahan Ke-2 (%i/%i)", pecahan_pembilang1, pecahan_penyebut1, pecahan_pembilang2, pecahan_penyebut2); 24 | }else if(hasil1 < hasil2){ 25 | printf("Pecahan Ke-1 (%i/%i) Lebih Kecil Dari Pecahan Ke-2 (%i/%i)", pecahan_pembilang1, pecahan_penyebut1, pecahan_pembilang2, pecahan_penyebut2); 26 | }else if(hasil1 > hasil2){ 27 | printf("Pecahan Ke-1 (%i/%i) Lebih Besar Dari Pecahan Ke-2 (%i/%i)", pecahan_pembilang1, pecahan_penyebut1, pecahan_pembilang2, pecahan_penyebut2); 28 | } 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /C++/Connected_components.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ░░░░░░░░░▄░░░░░░░░░░░░░░▄░░░░ 3 | ░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌░░░ 4 | ░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐░░░ 5 | ░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐░░░ 6 | ░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐░░░ 7 | ░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌░░░ 8 | ░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌░░ 9 | ░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐░░ 10 | ░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌░ 11 | ░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌░ 12 | ▀▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒▐░ 13 | ▐▒▒▐▀▐▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌ 14 | ▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒▐░ 15 | ░▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌░ 16 | ░▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▄▒▒▐░░ 17 | ░░▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌░░ 18 | ░░░░▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀░░░ 19 | ░░░░░░▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀░░░░░ 20 | ░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▀▀░░░░░░░░ 21 | */ 22 | 23 | // Github: GarvitV957 24 | 25 | #include 26 | using namespace std; 27 | #define ll long long 28 | #define lli long long int 29 | #define vi vector 30 | #define vvi vector 31 | #define vll vector 32 | #define vb vector 33 | #define pb push_back 34 | #define pii pair 35 | #define all(x) x.begin(),x.end() 36 | 37 | int N=1e6 +1; 38 | vvi adj(N); 39 | vi vis(N,0); 40 | 41 | vvi cc; 42 | vi current_comp; 43 | 44 | void dfs(int i){ 45 | vis[i]=1; 46 | current_comp.pb(i); 47 | for(auto v:adj[i]){ 48 | if(!vis[v]){ 49 | dfs(v); 50 | } 51 | } 52 | } 53 | 54 | int main(){ 55 | ios_base::sync_with_stdio(false); 56 | cin.tie(NULL); 57 | 58 | int n,e; 59 | cin>>n>>e; 60 | for(int i=0;i>x>>y; 63 | adj[x].pb(y),adj[y].pb(x); 64 | } 65 | int c=0; 66 | for(int i=1;i<=n;i++){ 67 | if(!vis[i]){ 68 | current_comp.clear(); 69 | dfs(i); 70 | cc.pb(current_comp); 71 | c++; 72 | } 73 | } 74 | cout< 3 | #include 4 | using namespace std; 5 | #define RANGE 200 6 | 7 | // The main function that sort 8 | // the given string arr[] in 9 | // alphabetical order 10 | void countSort(char arr[]) 11 | { 12 | // The output character array 13 | // that will have sorted arr 14 | char output[strlen(arr)]; 15 | 16 | // Create a count array to store count of individual 17 | // characters and initialize count array as 0 18 | int count[RANGE + 1], i; 19 | memset(count, 0, sizeof(count)); 20 | 21 | // Store count of each character 22 | for (i = 0; arr[i]; ++i) 23 | ++count[arr[i]]; 24 | 25 | // Change count[i] so that count[i] now contains actual 26 | // position of this character in output array 27 | for (i = 1; i <= RANGE; ++i) 28 | count[i] += count[i - 1]; 29 | 30 | // Build the output character array 31 | for (i = 0; arr[i]; ++i) { 32 | output[count[arr[i]] - 1] = arr[i]; 33 | --count[arr[i]]; 34 | } 35 | 36 | /* 37 | For Stable algorithm 38 | for (i = sizeof(arr)-1; i>=0; --i) 39 | { 40 | output[count[arr[i]]-1] = arr[i]; 41 | --count[arr[i]]; 42 | } 43 | 44 | For Logic : See implementation 45 | */ 46 | 47 | // Copy the output array to arr, so that arr now 48 | // contains sorted characters 49 | for (i = 0; arr[i]; ++i) 50 | arr[i] = output[i]; 51 | } 52 | 53 | // Driver code 54 | int main() 55 | { 56 | char arr[] = "countingsortincpp"; 57 | 58 | countSort(arr); 59 | 60 | cout << "Sorted character array is " << arr; 61 | return 0; 62 | } 63 | //github : atinder11 64 | 65 | 66 | -------------------------------------------------------------------------------- /C++/Dijkstra’s shortest path algorithm by Suraj.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | #define INFINITY 9999 5 | #define max 5 6 | void dijkstra(int G[max][max],int n,int startnode); 7 | int main() { 8 | int G[max][max]={{0,1,0,3,10},{1,0,5,0,0},{0,5,0,2,1},{3,0,2,0,6},{10,0,1,6,0}}; 9 | int n=5; 10 | int u=0; 11 | dijkstra(G,n,u); 12 | return 0; 13 | } 14 | void dijkstra(int G[max][max],int n,int startnode) { 15 | int cost[max][max],distance[max],pred[max]; 16 | int visited[max],count,mindistance,nextnode,i,j; 17 | for(i=0;i 2 | 3 | using namespace std; 4 | 5 | void heapify(int arr[], int n, int i) 6 | { 7 | int largest = i; 8 | int l = 2*i + 1; 9 | int r = 2*i + 2; 10 | 11 | //If left child is larger than root 12 | if (l < n && arr[l] > arr[largest]) 13 | largest = l; 14 | 15 | //If right child largest 16 | if (r < n && arr[r] > arr[largest]) 17 | largest = r; 18 | 19 | //If root is nor largest 20 | if (largest != i) 21 | { 22 | swap(arr[i], arr[largest]); 23 | 24 | //Recursively heapifying the sub-tree 25 | heapify(arr, n, largest); 26 | } 27 | } 28 | 29 | void heapSort(int arr[], int n) 30 | { 31 | 32 | for (int i = n / 2 - 1; i >= 0; i--) 33 | heapify(arr, n, i); 34 | 35 | //One by one extract an element from heap 36 | for (int i=n-1; i>=0; i--) 37 | { 38 | //Moving current root to end 39 | swap(arr[0], arr[i]); 40 | 41 | //Calling max heapify on the reduced heap 42 | heapify(arr, i, 0); 43 | } 44 | } 45 | 46 | //Function to print array 47 | void display(int arr[], int n) 48 | { 49 | for (int i = 0; i < n; i++) 50 | { 51 | cout << arr[i] << "\t"; 52 | } 53 | cout << "\n"; 54 | } 55 | 56 | 57 | int main() 58 | { 59 | int arr[] = {1, 14, 3, 7, 0}; 60 | int n = sizeof(arr)/sizeof(arr[0]); 61 | cout << "Unsorted array \n"; 62 | display(arr, n); 63 | 64 | heapSort(arr, n); 65 | 66 | cout << "Sorted array \n"; 67 | display(arr, n); 68 | } 69 | -------------------------------------------------------------------------------- /C++/Kadanes_Algorithm.cpp: -------------------------------------------------------------------------------- 1 | // Github Username: amitShindeGit 2 | #include 3 | using namespace std; 4 | 5 | class Solution{ 6 | public: 7 | // arr: input array 8 | // n: size of array 9 | //Function to find the sum of contiguous subarray with maximum sum. 10 | long long max(long long x, long long y){ 11 | if(x > y){ 12 | return x; 13 | }else{ 14 | return y; 15 | } 16 | } 17 | 18 | long long maxSubarraySum(int arr[], int n){ 19 | 20 | // Your code here 21 | long long max_current = arr[0]; 22 | long long max_global = arr[0]; 23 | 24 | for(int i=1; i<=n-1; i++){ 25 | max_current = max(arr[i], max_current + arr[i]); 26 | // cout << max_current << " " << max_global << endl; 27 | 28 | if(max_current > max_global){ 29 | max_global = max_current; 30 | } 31 | } 32 | 33 | return max_global; 34 | 35 | } 36 | }; 37 | 38 | 39 | int main() 40 | { 41 | int t,n; 42 | 43 | cin>>t; //input testcases 44 | while(t--) //while testcases exist 45 | { 46 | 47 | cin>>n; //input size of array 48 | 49 | int a[n]; 50 | 51 | for(int i=0;i>a[i]; //inputting elements of array 53 | 54 | Solution ob; 55 | 56 | cout << ob.maxSubarraySum(a, n) << endl; 57 | } 58 | } -------------------------------------------------------------------------------- /C++/Knapsack Problem by Suraj.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define MAX 10 3 | using namespace std; 4 | struct product 5 | { 6 | int product_num; 7 | int profit; 8 | int weight; 9 | float ratio; 10 | float take_quantity; 11 | }; 12 | int main() 13 | { 14 | product P[MAX],temp; 15 | int i,j,total_product,capacity; 16 | float value=0; 17 | cout<<"ENTER NUMBER OF ITEMS : "; 18 | cin>>total_product; 19 | cout<<"ENTER CAPACITY OF SACK : "; 20 | cin>>capacity; 21 | cout<<"\n"; 22 | for(i=0;i>P[i].profit>>P[i].weight; 27 | P[i].ratio=(float)P[i].profit/P[i].weight; 28 | P[i].take_quantity=0; 29 | } 30 | //HIGHEST RATIO BASED SORTING 31 | for(i=0;icapacity) 53 | { 54 | P[i].take_quantity=(float)capacity/P[i].weight; 55 | capacity=0; 56 | } 57 | } 58 | cout<<"\n\nPRODUCTS TO BE TAKEN -"; 59 | for(i=0;i 7 | using namespace std; 8 | void merging(int input[],int start,int end){ 9 | int mid = (start+end)/2; 10 | int i=start, j=mid+1, k=start; 11 | int ans[end+1]; 12 | while(i<=mid&&j<=end){ 13 | if(input[i]=end){ 41 | return; 42 | } 43 | int mid = ((start+end)/2); 44 | merge_sort(input,start,mid); 45 | merge_sort(input,mid+1,end); 46 | merging(input,start,end); 47 | 48 | 49 | } 50 | 51 | 52 | 53 | void mergeSort(int input[], int size){ 54 | // Write your code here 55 | 56 | merge_sort(input,0,size-1); 57 | 58 | 59 | 60 | } 61 | 62 | -------------------------------------------------------------------------------- /C++/Pow.cpp: -------------------------------------------------------------------------------- 1 | //https://leetcode.com/problems/powx-n/ 2 | 3 | class Solution { 4 | public: 5 | double myPow(double x, int n) { 6 | double res=1; 7 | if (n == INT_MAX) 8 | return x; 9 | else if (n == INT_MIN) 10 | return (x == 1 || x == -1) ? 1 : 0; 11 | if(n<0) x=1/x, n*=-1; 12 | for(int i=1; i<=n;i++){ 13 | res=res*x; 14 | } 15 | return res; 16 | } 17 | }; 18 | 19 | //by - khushi marothi 20 | -------------------------------------------------------------------------------- /C++/Power_of_2.cpp: -------------------------------------------------------------------------------- 1 | // Author: ADARSH 2 | // Date Modified: 01/10/2022 3 | 4 | #include 5 | using namespace std; 6 | 7 | bool isPowerOf2(int n) { 8 | return (n && !(n & (n - 1))); 9 | } 10 | 11 | int main(int argc, char const *argv[]) 12 | { 13 | int n; 14 | cout << "Enter a number: "; 15 | cin >> n; 16 | cout << ((isPowerOf2(n)) ? "It's a power of 2." : "It's not a power of 2."); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /C++/Reverse_integer.cpp: -------------------------------------------------------------------------------- 1 | //https://leetcode.com/problems/reverse-integer/ 2 | 3 | #include 4 | using namespace std; 5 | 6 | int reverse(int x) { 7 | long int reverse=0; 8 | while(x!=0){ 9 | int digit=x%10; 10 | reverse=reverse*10+ digit; 11 | x=x/10; 12 | } 13 | return reverse; } 14 | int main(){ 15 | int x=2486; 16 | cout<<"Reverse no : "< 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int rule(char p, char c){ 7 | if (p == c){ 8 | return 0; 9 | } 10 | 11 | if (p == 'r' && c == 'p'){ 12 | return -1; 13 | } 14 | else if (p == 's' && c == 'p'){ 15 | return 1; 16 | } 17 | else if (p == 'p' && c == 'r'){ 18 | return 1; 19 | } 20 | else if (p == 's' && c == 'r'){ 21 | return -1; 22 | } 23 | else if (p == 'r' && c == 's'){ 24 | return 1; 25 | } 26 | else if (p == 'p' && c == 's'){ 27 | return -1; 28 | } 29 | } 30 | 31 | int main(){ 32 | 33 | char computer; 34 | char player; 35 | char playmore; 36 | cout << "\t\t\t\t"; 37 | for(int i = 0; i < 50; i++){ 38 | cout << "-"; 39 | } 40 | cout << endl; 41 | cout << "\t\t\t\t"; 42 | cout << "\t Welcome to Rock, Paper and Scissors Game" << endl; 43 | cout << "\t\t\t\t"; 44 | for(int i = 0; i < 50; i++){ 45 | cout << "-"; 46 | } 47 | cout << endl; 48 | cout << "\t\t\t\t"; 49 | cout << "\t Note: " << endl; 50 | cout << "\t\t\t\t"; 51 | cout << "\t\t r : Rock" << endl << "\t\t\t\t" << "\t\t p - Paper" << endl << "\t\t\t\t" << "\t\t scissor" << endl << "\t\t\t\t"<< endl << endl; 52 | cout << "\t\t\t\t"; 53 | for(int i = 0; i < 50; i++){ 54 | cout << "-"; 55 | } 56 | cout << endl; 57 | do{ 58 | int number = 0; 59 | srand(time(0)); // initialized time to 0 60 | number = rand() % 100; // will choose a number in range 0 - 99 61 | // r - for rock 62 | // p - for paper 63 | // s - for scissors 64 | if (number < 33) 65 | { 66 | computer = 'r'; 67 | } 68 | else if (number > 66) 69 | { 70 | computer = 's'; 71 | } 72 | else 73 | { 74 | computer = 'p'; 75 | } 76 | // cout << "Note: \"r\" for \"Rock\", \"p\" for \"Paper\", \"s\" for \"Scissor\"." << endl; 77 | cout << "\t\t\t\t"; 78 | cout << "Enter your choice: "; 79 | cin >> player; 80 | int result = rule(player, computer); 81 | if(result == 1){ 82 | cout << "\t\t\t\t"; 83 | cout << "You won! Hurray" << endl; 84 | } 85 | else if(result == -1){ 86 | cout << "\t\t\t\t"; 87 | cout << "You lose! Bad Luck" << endl; 88 | } 89 | else{ 90 | cout << "\t\t\t\t"; 91 | cout << "Woah! That's Tie!" << endl; 92 | } 93 | cout << "\t\t\t\t"; 94 | cout << "Do you want to Play Again?" << endl; 95 | cout << "\t\t\t\t"; 96 | cout << "Note: Press 'n' to exit! Press Anything to continue: "; 97 | cin >> playmore; 98 | cout << "\t\t\t\t"; 99 | for(int i = 0; i < 50; i++){ 100 | cout << "-"; 101 | } 102 | cout << endl; 103 | }while(playmore != 'n'); 104 | 105 | return 0; 106 | } 107 | -------------------------------------------------------------------------------- /C++/Search in Rotated Sorted Matrix: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | int search(vector& nums, int target) 4 | { 5 | //binary search 6 | int l=0; 7 | int n= nums.size(); 8 | int r = n-1; 9 | while(l<=r) 10 | { 11 | int mid = l+(r-l)/2; 12 | if(nums[mid]==target) 13 | { 14 | return mid; 15 | } 16 | if(nums[l]<=nums[mid]) //left sorted 17 | { 18 | if(nums[l]<=target && nums[mid]>target) 19 | { 20 | r = mid-1; 21 | } 22 | else 23 | l = mid+1; 24 | } 25 | else //right sorted 26 | { 27 | if(nums[mid]=target) 28 | { 29 | l= mid+1; 30 | } 31 | else 32 | r=mid-1; 33 | 34 | } 35 | } 36 | return -1; 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /C++/Search_a_2D_Matrix.cpp: -------------------------------------------------------------------------------- 1 | // C++ program to search an element in row-wise 2 | // and column-wise sorted matrix 3 | #include 4 | 5 | using namespace std; 6 | 7 | /* Searches the element x in mat[][]. If the 8 | element is found, then prints its position 9 | and returns true, otherwise prints "not found" 10 | and returns false */ 11 | int search(int mat[4][4], int n, int x) 12 | { 13 | if (n == 0) 14 | return -1; 15 | 16 | // traverse through the matrix 17 | for (int i = 0; i < n; i++) { 18 | for (int j = 0; j < n; j++) 19 | // if the element is found 20 | if (mat[i][j] == x) { 21 | cout << "Element found at (" << i << ", " 22 | << j << ")\n"; 23 | return 1; 24 | } 25 | } 26 | 27 | cout << "n Element not found"; 28 | return 0; 29 | } 30 | 31 | // Driver code 32 | int main() 33 | { 34 | int mat[4][4] = { { 10, 20, 30, 40 }, 35 | { 15, 25, 35, 45 }, 36 | { 27, 29, 37, 48 }, 37 | { 32, 33, 39, 50 } }; 38 | 39 | // Function call 40 | search(mat, 4, 29); 41 | 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /C++/Tower of Hanoi By Suraj.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | void TOH(int d, char t1, char t2, char t3) 5 | { 6 | if(d==1) 7 | { 8 | cout<<"\nShift top disk from tower"<>disk; 19 | if(disk<1) 20 | cout<<"There are no disks to shift"; 21 | else 22 | cout<<"There are "< 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | cout<<"Enter Number of rows and coluns: "; 7 | cin>>n; 8 | int a[n][n]; 9 | for(int i=0;i>a[i][j]; 15 | } 16 | } 17 | 18 | cout<<"Given Matrix: \n"; 19 | for(int i=0;i 6 | using namespace std; 7 | 8 | const int ALPHABET_SIZE = 26; 9 | 10 | struct TrieNode 11 | { 12 | struct TrieNode *children[ALPHABET_SIZE]; 13 | 14 | bool isEndOfWord; 15 | }; 16 | 17 | struct TrieNode *getNode(void) 18 | { 19 | struct TrieNode *pNode = new TrieNode; 20 | 21 | pNode->isEndOfWord = false; 22 | 23 | for (int i = 0; i < ALPHABET_SIZE; i++) 24 | pNode->children[i] = NULL; 25 | 26 | return pNode; 27 | } 28 | 29 | void insert(struct TrieNode *root, string key) 30 | { 31 | struct TrieNode *pCrawl = root; 32 | 33 | for (int i = 0; i < key.length(); i++) 34 | { 35 | int index = key[i] - 'a'; 36 | if (!pCrawl->children[index]) 37 | pCrawl->children[index] = getNode(); 38 | 39 | pCrawl = pCrawl->children[index]; 40 | } 41 | 42 | pCrawl->isEndOfWord = true; 43 | } 44 | 45 | bool search(struct TrieNode *root, string key) 46 | { 47 | struct TrieNode *pCrawl = root; 48 | 49 | for (int i = 0; i < key.length(); i++) 50 | { 51 | int index = key[i] - 'a'; 52 | if (!pCrawl->children[index]) 53 | return false; 54 | 55 | pCrawl = pCrawl->children[index]; 56 | } 57 | 58 | return (pCrawl->isEndOfWord); 59 | } 60 | 61 | int main() 62 | { 63 | 64 | string keys[] = {"the", "a", "there", 65 | "answer", "any", "by", 66 | "bye", "their"}; 67 | int n = sizeof(keys) / sizeof(keys[0]); 68 | 69 | struct TrieNode *root = getNode(); 70 | 71 | for (int i = 0; i < n; i++) 72 | insert(root, keys[i]); 73 | 74 | char output[][32] = {"Not present in trie", "Present in trie"}; 75 | 76 | cout << "the" 77 | << " --- " << output[search(root, "the")] << endl; 78 | cout << "these" 79 | << " --- " << output[search(root, "these")] << endl; 80 | cout << "their" 81 | << " --- " << output[search(root, "their")] << endl; 82 | cout << "thaw" 83 | << " --- " << output[search(root, "thaw")] << endl; 84 | return 0; 85 | } 86 | -------------------------------------------------------------------------------- /C++/XOR LL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | class Node 7 | { 8 | public: 9 | int data; 10 | Node *xnode; 11 | }; 12 | 13 | Node *Xor(Node *x, Node *y) 14 | { 15 | return reinterpret_cast( 16 | reinterpret_cast(x) ^ reinterpret_cast(y)); 17 | } 18 | 19 | void insert(Node **head_ref, int data) 20 | { 21 | 22 | Node *new_node = new Node(); 23 | new_node->data = data; 24 | 25 | new_node->xnode = *head_ref; 26 | 27 | if (*head_ref != NULL) 28 | { 29 | 30 | (*head_ref) 31 | ->xnode = Xor(new_node, (*head_ref)->xnode); 32 | } 33 | 34 | *head_ref = new_node; 35 | } 36 | 37 | void printList(Node *head) 38 | { 39 | Node *curr = head; 40 | Node *prev = NULL; 41 | Node *next; 42 | 43 | cout << "The nodes of Linked List are: \n"; 44 | 45 | while (curr != NULL) 46 | { 47 | 48 | cout << curr->data << " "; 49 | 50 | next = Xor(prev, curr->xnode); 51 | 52 | prev = curr; 53 | curr = next; 54 | } 55 | } 56 | 57 | int main() 58 | { 59 | Node *head = NULL; 60 | insert(&head, 10); 61 | insert(&head, 100); 62 | insert(&head, 1000); 63 | insert(&head, 10000); 64 | 65 | printList(head); 66 | 67 | return (0); 68 | } 69 | -------------------------------------------------------------------------------- /C++/bucketSort.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Authors Name : Utkarsh Tyagi 3 | Date Modified: 1 October, 2022 4 | */ 5 | // C++ program to sort an 6 | // array using bucket sort 7 | #include 8 | #include 9 | #include 10 | using namespace std; 11 | 12 | // Function to sort arr[] of 13 | // size n using bucket sort 14 | void bucketSort(float arr[], int n) 15 | { 16 | 17 | // 1) Create n empty buckets 18 | vector b[n]; 19 | 20 | // 2) Put array elements 21 | // in different buckets 22 | for (int i = 0; i < n; i++) { 23 | int bi = n * arr[i]; // Index in bucket 24 | b[bi].push_back(arr[i]); 25 | } 26 | 27 | // 3) Sort individual buckets 28 | for (int i = 0; i < n; i++) 29 | sort(b[i].begin(), b[i].end()); 30 | 31 | // 4) Concatenate all buckets into arr[] 32 | int index = 0; 33 | for (int i = 0; i < n; i++) 34 | for (int j = 0; j < b[i].size(); j++) 35 | arr[index++] = b[i][j]; 36 | } 37 | 38 | /* Driver program to test above function */ 39 | int main() 40 | { 41 | float arr[] 42 | = { 0.897, 0.565, 0.656, 0.1234, 0.665, 0.3434 }; 43 | int n = sizeof(arr) / sizeof(arr[0]); 44 | bucketSort(arr, n); 45 | 46 | cout << "Sorted array is \n"; 47 | for (int i = 0; i < n; i++) 48 | cout << arr[i] << " "; 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /C++/create_segment_tree.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | segment tree 3 | You have given an array A of n elements. Your task is to process q queries of the following types. 4 | 1 i x : Update the value at position i to x. 5 | 2 i j : Print the sum of values in the range [i, j]. 6 | */ 7 | 8 | #include 9 | using namespace std; 10 | typedef long long int ll; //g++ ll.cpp -o ll.exe 11 | typedef long double ld; 12 | typedef pair iii; //all elements to 0 13 | const ll mod =1e9+7; 14 | 15 | 16 | 17 | struct node 18 | { 19 | ll x; 20 | 21 | }; 22 | 23 | 24 | vector g; 25 | vector ar; 26 | 27 | node merge(node a,node b) 28 | { 29 | node temp; 30 | temp.x=a.x+b.x; 31 | return temp; 32 | } 33 | 34 | void build(ll index,ll l,ll r) 35 | { 36 | 37 | if(l==r) 38 | { 39 | node tt; 40 | tt.x=ar[l]; 41 | g[index]=tt; 42 | return; 43 | } 44 | 45 | ll mid; 46 | mid=(l+r)/2; 47 | build(2*index,l,mid); 48 | build(2*index+1,mid+1,r); 49 | g[index]=merge(g[2*index],g[2*index+1]); 50 | } 51 | 52 | void update(ll index,ll l,ll r,ll pos,ll value) 53 | { 54 | 55 | if((posr)) 56 | return; 57 | 58 | 59 | if(l==r) 60 | { 61 | //cout< r || rq=r) 88 | return(g[index]); 89 | 90 | ll mid=(l+r)/2; 91 | ans=merge(query(2*index,l,mid,lq,rq),query(2*index+1,mid+1,r,lq,rq)); 92 | 93 | return(ans); 94 | 95 | 96 | 97 | } 98 | 99 | 100 | int main() 101 | { 102 | #ifndef ONLINE_JUDGE 103 | freopen("input.txt", "r", stdin); 104 | freopen("output.txt", "w", stdout); 105 | #endif 106 | ios_base::sync_with_stdio(0); 107 | cin.tie(0); cout.tie(0); 108 | 109 | ll n,q; 110 | cin>>n>>q; 111 | 112 | g.resize(4*n+6); 113 | ar.resize(n+1); 114 | 115 | for(ll i=1;i<=n;i++) 116 | cin>>ar[i]; 117 | 118 | build(1,1,n); 119 | 120 | while(q--) 121 | { 122 | ll t; 123 | cin>>t; 124 | if(t==1) 125 | { 126 | ll i,x; 127 | cin>>i>>x; 128 | update(1,1,n,i,x); 129 | } 130 | if(t==2) 131 | { 132 | ll lq,rq; 133 | cin>>lq>>rq; 134 | node temp; 135 | temp=query(1,1,n,lq,rq); 136 | cout< 5 | #include 6 | 7 | using namespace std; 8 | 9 | #define lol long 10 | 11 | lol a[1000005], frequency[1000005]; 12 | 13 | int main() { 14 | 15 | // #ifndef ONLINE_JUDGE 16 | // freopen("input.txt", "r", stdin); 17 | // freopen("output.txt", "w", stdout); 18 | // #endif 19 | 20 | int t; 21 | cin >> t; 22 | 23 | while (t--) { 24 | int n; 25 | cin >> n; 26 | 27 | memset(frequency, 0, sizeof(frequency)); 28 | frequency[0] = 1; 29 | 30 | lol sum = 0; 31 | 32 | for (int i = 0; i < n; i++) { 33 | cin >> a[i]; 34 | 35 | sum += a[i]; 36 | sum %= n; 37 | sum = (sum + n) % n; // sum+n because if we encountered negative value 38 | frequency[sum] += 1; 39 | } 40 | 41 | lol ans = 0; 42 | 43 | for (int i = 0; i < n; i++) { 44 | if (frequency[i] > 1) { 45 | lol m = frequency[i]; 46 | ans += (m * (m - 1)) / 2; 47 | } 48 | } 49 | cout << ans << endl; 50 | } 51 | 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /C++/factorial.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | class Factorial 5 | { 6 | private: 7 | int num; 8 | int factorial = 1; 9 | 10 | public: 11 | void calculateFactorial(); 12 | void show(); 13 | }; 14 | 15 | void 16 | Factorial::calculateFactorial() 17 | { 18 | cout << "Enter a number : " << endl; 19 | cin >> num; 20 | 21 | if (num == 0 || num == 1) 22 | { 23 | factorial = 1; 24 | } 25 | else 26 | { 27 | while (num > 1) 28 | { 29 | factorial = factorial * num; 30 | num--; 31 | } 32 | } 33 | } 34 | 35 | void Factorial::show() 36 | { 37 | cout << "Factorial : " << factorial << endl; 38 | } 39 | 40 | int main() 41 | { 42 | Factorial factorial; 43 | factorial.calculateFactorial(); 44 | factorial.show(); 45 | } 46 | -------------------------------------------------------------------------------- /C++/factorialprogram.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | // github username navdeepk037 https://github.com/navdeepk037 4 | int fact(int n) 5 | { 6 | int factorial=1; 7 | for(int i=n;i>=1;i--) 8 | factorial=factorial*i; 9 | return factorial; 10 | } 11 | int main(){ 12 | int n; 13 | cout<<"enter the number "; 14 | cin>>n; 15 | cout<<"the factorial of the number is "<next : headB; 22 | curB = curB ? curB->next : headA; 23 | } 24 | return curA; 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /C++/kmp_algotihm.cpp: -------------------------------------------------------------------------------- 1 | // C++ program for implementation of KMP pattern searching algorithm 2 | #include 3 | 4 | void computeLPSArray(char* pat, int M, int* lps); 5 | 6 | // Prints occurrences of txt[] in pat[] 7 | void KMPSearch(char* pat, char* txt) 8 | { 9 | int M = strlen(pat); 10 | int N = strlen(txt); 11 | 12 | // create lps[] that will hold the longest prefix suffix 13 | // values for pattern 14 | int lps[M]; 15 | 16 | // Preprocess the pattern (calculate lps[] array) 17 | computeLPSArray(pat, M, lps); 18 | 19 | int i = 0; // index for txt[] 20 | int j = 0; // index for pat[] 21 | while ((N - i) >= (M - j)) { 22 | if (pat[j] == txt[i]) { 23 | j++; 24 | i++; 25 | } 26 | 27 | if (j == M) { 28 | printf("Found pattern at index %d ", i - j); 29 | j = lps[j - 1]; 30 | } 31 | 32 | // mismatch after j matches 33 | else if (i < N && pat[j] != txt[i]) { 34 | // Do not match lps[0..lps[j-1]] characters, 35 | // they will match anyway 36 | if (j != 0) 37 | j = lps[j - 1]; 38 | else 39 | i = i + 1; 40 | } 41 | } 42 | } 43 | 44 | // Fills lps[] for given pattern pat[0..M-1] 45 | void computeLPSArray(char* pat, int M, int* lps) 46 | { 47 | // length of the previous longest prefix suffix 48 | int len = 0; 49 | 50 | lps[0] = 0; // lps[0] is always 0 51 | 52 | // the loop calculates lps[i] for i = 1 to M-1 53 | int i = 1; 54 | while (i < M) { 55 | if (pat[i] == pat[len]) { 56 | len++; 57 | lps[i] = len; 58 | i++; 59 | } 60 | else // (pat[i] != pat[len]) 61 | { 62 | // This is tricky. Consider the example. 63 | // AAACAAAA and i = 7. The idea is similar 64 | // to search step. 65 | if (len != 0) { 66 | len = lps[len - 1]; 67 | 68 | // Also, note that we do not increment 69 | // i here 70 | } 71 | else // if (len == 0) 72 | { 73 | lps[i] = 0; 74 | i++; 75 | } 76 | } 77 | } 78 | } 79 | 80 | // Driver program to test above function 81 | int main() 82 | { 83 | char txt[] = "CDCDABABDABACCDCDDABABCABABCDCD"; 84 | char pat[] = "ABABCABAB"; 85 | KMPSearch(pat, txt); 86 | return 0; 87 | } 88 | -------------------------------------------------------------------------------- /C++/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(){ 4 | cout<<"Namaste Bharat"; 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /C++/pattern.cpp: -------------------------------------------------------------------------------- 1 | // ProgrammerDG 2 | 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | int rows; 9 | 10 | cout << "Enter number of rows: "; 11 | cin >> rows; 12 | 13 | for(int i = 1; i <= rows; ++i) 14 | { 15 | for(int j = 1; j <= i; ++j) 16 | { 17 | cout << "* "; 18 | } 19 | cout << "\n"; 20 | } 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /C++/square pattern in cpp.cpp: -------------------------------------------------------------------------------- 1 | // AdrshCode 2 | 3 | #include 4 | using namespace std; 5 | int main() { 6 | int row = 4, column = 4; 7 | for (int i = 1; i <= row ; i++){ 8 | for (int j = 1; j <= column ; j++) 9 | cout << " * "; 10 | cout << endl; 11 | } 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /C++/starpattern.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Problem Input and Output --------- 4 | 5 | Star Pattern : It takes input from the user and produces the star pattern accordingly as given below.. 6 | 7 | For eg :-- 8 | Inout: 9 | 10 | Enter the value of n: 5 11 | Output: 12 | * 13 | * * 14 | * * * 15 | * * * * 16 | * * * * * 17 | * * * * 18 | * * * 19 | * * 20 | * 21 | 22 | Enter the value of n: 8 23 | Output: 24 | * 25 | * * 26 | * * * 27 | * * * * 28 | * * * * * 29 | * * * * * * 30 | * * * * * * * 31 | * * * * * * * * 32 | * * * * * * * 33 | * * * * * * 34 | * * * * * 35 | * * * * 36 | * * * 37 | * * 38 | * 39 | 40 | 41 | */ 42 | 43 | 44 | #include 45 | using namespace std; 46 | 47 | int main(){ 48 | 49 | int n ; cout << "Enter the value of n : " ; 50 | cin >> n; 51 | for (int i = 0; i < n; i++) 52 | { 53 | for (int j = 0; j < i+1; j++) 54 | { 55 | cout << "* " ; 56 | } 57 | cout << endl ; 58 | 59 | } 60 | for (int i = n-1; i >= 0; i--) 61 | { 62 | for (int j = 0; j < i; j++) 63 | { 64 | cout << "* " ; 65 | } 66 | cout << endl ; 67 | 68 | } 69 | 70 | return 0; 71 | } -------------------------------------------------------------------------------- /C/Bernoulli Probability.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main() { 4 | float a,n,r,ncr,p; 5 | float x,y,z,fact1,fact2,fact3; 6 | 7 | fact1=1; 8 | for(x=1; x<=n;x++) 9 | fact1=fact1*x; 10 | fact2=1; 11 | for(y=1; y<=r;y++) 12 | fact2=fact2*y; 13 | fact3=3; 14 | for(z=1; z<=n;z++) 15 | fact3=fact3*z; 16 | printf("Provide the probability of success="); 17 | scanf("%f",&a); 18 | if (a>1) 19 | printf ("Input error"); 20 | else{ 21 | printf("Provide number of trials held="); 22 | scanf("%f",&n); 23 | printf("Provide your desired number of success="); 24 | scanf("%f",&r); 25 | if (r>n) 26 | printf("Input Error"); 27 | else 28 | { 29 | ncr= fact1/((fact2)*(fact3)); 30 | p= ncr*pow(a,r)*pow(1-a,n-r); 31 | if (p>1) 32 | printf("Input Error, Check Again"); 33 | else 34 | printf("Your asked probability=%f",p); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /C/BubbleSort.c: -------------------------------------------------------------------------------- 1 | // PradeepKhatri - https://github.com/PradeepKhatri 2 | 3 | #include 4 | 5 | void printArray(int *A,int n) 6 | { 7 | for(int i=0;i A[j+1]) 22 | { 23 | temp = A[j]; 24 | A[j] = A[j+1]; 25 | A[j+1] = temp; 26 | } 27 | } 28 | } 29 | } 30 | 31 | int main() 32 | { 33 | int A[] = {5,7,3,1,2}; 34 | int n = 5; 35 | printArray(A,n); 36 | BubbleSort(A,n); 37 | printArray(A,n); 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /C/Star Pattern 1 in C.c: -------------------------------------------------------------------------------- 1 | // Sarthak Roy (sarthakroy2002) 2 | #include 3 | int main() 4 | { 5 | for(int i=0;i<5;i++) 6 | { 7 | for(int j=i;j<5;j++) 8 | { 9 | printf("*"); 10 | } 11 | printf("\n"); 12 | } 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /C/Taylor Series.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float Taylor_exponential(int n, float x) 5 | { 6 | float exp_sum = 1; 7 | for (int i = n - 1; i > 0; --i ) 8 | exp_sum = 1 + x * exp_sum / i; 9 | return exp_sum; 10 | } 11 | int main(void) 12 | { 13 | int n = 25; 14 | float x = 5.0; 15 | 16 | if (n>0 && x>0) 17 | { 18 | printf("value of n = %d and x = %d ", n, x ); 19 | printf("\ne^x = %f",Taylor_exponential(n,x)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /C/dsa_polynomial_Parnani.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | void accept(int [],int); 5 | void disp(int [],int); 6 | void add(int [],int [],int [], int); 7 | void sub(int [],int [],int [], int); 8 | void multi(int [],int [],int [], int); 9 | void initpoly(int []); 10 | void main() 11 | { 12 | int a[10],b[10],c[10],n,ch,x,k,m; 13 | do 14 | { 15 | printf("\n\n Main Menu \n"); 16 | printf("\n1.Addition \n"); 17 | printf("\n2.Subtraction\n"); 18 | printf("\n3.Multiplication\n"); 19 | printf("\n4.Exit \n"); 20 | printf("\n\nEnter ur Choice\n"); 21 | scanf("%d",&ch); 22 | switch(ch) 23 | { 24 | case 1: 25 | initpoly(a); 26 | initpoly(b); 27 | initpoly(c); 28 | printf("\nEnter the Order of 1st Polynomial\n"); 29 | scanf("%d",&m); 30 | accept(a,m); 31 | printf("\nEnter the order of 2nd Polynomial \n"); 32 | scanf("%d",&n); 33 | accept(b,n); 34 | printf("\n\nPolynomial 1 \n\n"); 35 | disp(a,m); 36 | printf("\n\nPolynomial 2 \n\n"); 37 | disp(b,n); 38 | k=m>n ? m:n; 39 | add(a,b,c,k); 40 | printf("\n\nResultant polynomial Is \n\n"); 41 | disp(c,k); 42 | break; 43 | case 2: 44 | initpoly(a); 45 | initpoly(b); 46 | initpoly(c); 47 | printf("\nEnter the Order of 1st Polynomial\n"); 48 | scanf("%d",&m); 49 | accept(a,m); 50 | printf("\nEnter the order of 2nd Polynomial \n"); 51 | scanf("%d",&n); 52 | accept(b,n); 53 | printf("\n\nPolynomial 1 \n\n"); 54 | disp(a,m); 55 | printf("\n\nPolynomial 2 \n\n"); 56 | disp(b,n); 57 | k=m>n ? m:n; 58 | sub(a,b,c,k); 59 | printf("\n\nResultant polynomial Is \n\n"); 60 | disp(c,k); 61 | break; 62 | case 3: 63 | initpoly(a); 64 | initpoly(b); 65 | initpoly(c); 66 | printf("\nEnter the Order of 1st Polynomial\n"); 67 | scanf("%d",&m); 68 | accept(a,m); 69 | printf("\nEnter the order of 2nd Polynomial \n"); 70 | scanf("%d",&n); 71 | accept(b,n); 72 | printf("\n\nPolynomial 1 \n\n"); 73 | disp(a,m); 74 | printf("\n\nPolynomial 2 \n\n"); 75 | disp(b,n); 76 | k=m>n ? m:n; 77 | multi(a,b,c,k); 78 | printf("\n\nResultant polynomial Is \n\n"); 79 | disp(c,k); 80 | break; 81 | case 4: 82 | exit(0); 83 | } 84 | } 85 | while(ch!=4); 86 | } 87 | void initpoly(int z[]) 88 | { 89 | int i; 90 | for(i=0;i<10;i++) 91 | z[i]=0; 92 | } 93 | void add(int a[],int b[],int c[],int n) 94 | { 95 | int i; 96 | for(i=n;i>=0;i--) 97 | { 98 | c[i]=a[i]+b[i]; 99 | } 100 | } 101 | void sub(int a[],int b[],int c[],int n) 102 | { 103 | int i; 104 | for(i=n;i>=0;i--) 105 | { 106 | c[i]=a[i]-b[i]; 107 | } 108 | } 109 | void multi(int a[],int b[],int c[],int n) 110 | { 111 | int i; 112 | for(i=n;i>=0;i--) 113 | { 114 | c[i]=a[i]*b[i]; 115 | } 116 | } 117 | void accept(int a[],int n) 118 | { 119 | int i; 120 | for(i=n;i>=0;i--) 121 | { 122 | printf("\nEnter the Co-efficient of a[%d] term :\t",i); 123 | scanf("%d",&a[i]); 124 | } 125 | } 126 | void disp(int a[],int n) 127 | { 128 | int i; 129 | for(i=n;i>0;i--) 130 | { 131 | if(a[i]!=0) 132 | { 133 | printf("%dX^%d+",a[i],i); 134 | } 135 | } 136 | printf("%d",a[i]); 137 | } -------------------------------------------------------------------------------- /C/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | printf("Namaste Bharat"); 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /C/print ip address and hostname.c: -------------------------------------------------------------------------------- 1 | // C program to display hostname 2 | // and IP address 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | // Returns hostname for the local computer 14 | void checkHostName(int hostname) 15 | { 16 | if (hostname == -1) 17 | { 18 | perror("gethostname"); 19 | exit(1); 20 | } 21 | } 22 | 23 | // Returns host information corresponding to host name 24 | void checkHostEntry(struct hostent * hostentry) 25 | { 26 | if (hostentry == NULL) 27 | { 28 | perror("gethostbyname"); 29 | exit(1); 30 | } 31 | } 32 | 33 | // Converts space-delimited IPv4 addresses 34 | // to dotted-decimal format 35 | void checkIPbuffer(char *IPbuffer) 36 | { 37 | if (NULL == IPbuffer) 38 | { 39 | perror("inet_ntoa"); 40 | exit(1); 41 | } 42 | } 43 | 44 | // Driver code 45 | int main() 46 | { 47 | char hostbuffer[256]; 48 | char *IPbuffer; 49 | struct hostent *host_entry; 50 | int hostname; 51 | 52 | // To retrieve hostname 53 | hostname = gethostname(hostbuffer, sizeof(hostbuffer)); 54 | checkHostName(hostname); 55 | 56 | // To retrieve host information 57 | host_entry = gethostbyname(hostbuffer); 58 | checkHostEntry(host_entry); 59 | 60 | // To convert an Internet network 61 | // address into ASCII string 62 | IPbuffer = inet_ntoa(*((struct in_addr*) 63 | host_entry->h_addr_list[0])); 64 | 65 | printf("Hostname: %s\n", hostbuffer); 66 | printf("Host IP: %s", IPbuffer); 67 | 68 | return 0; 69 | } 70 | -------------------------------------------------------------------------------- /C/selection_sort.c: -------------------------------------------------------------------------------- 1 | /* 2 | Author : Prathamesh Patil 3 | In selection sort, 4 | we get the least from array and place it at first position, then recursively leaving the first element do the same 5 | */ 6 | 7 | 8 | #include 9 | 10 | //declaration of display function 11 | void display(int array[], int size) 12 | { 13 | for (int i = 0; i < size; i++) 14 | { 15 | printf("%d ", array[i]); 16 | } 17 | } 18 | 19 | //declaration of funtion :- selection sort 20 | void selection_sort(int array[], int size) 21 | { 22 | int least, i, j, temp, l; 23 | 24 | for ( i = 0; i < size; i++) //loop for accessing the ith element from array 25 | { 26 | least = array[i]; //taking the i element as the least starting from 0 27 | printf("Least : %d") 28 | 29 | for ( j = i + 1; j < size; j++) //loop for comparing the array elements with ith element 30 | { 31 | if (least > array[j]) //getting the least element from the array 32 | { 33 | least = array[j]; //storing it in the least variable 34 | l=j; //storing the index of least variable in l 35 | } 36 | } 37 | //swap logic in least and ith element 38 | temp = array[i]; 39 | array[i] = array[l]; 40 | array[l] = temp; 41 | } 42 | } 43 | 44 | int main() 45 | { 46 | int array[5] = {23,11,1,35,21}; 47 | int size = 5; 48 | 49 | //calling the selection_sort funtion 50 | selection_sort(array, size); 51 | 52 | //calling the display function 53 | display(array, size); 54 | 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /C/square pattern in c.c: -------------------------------------------------------------------------------- 1 | // AdrshCode 2 | 3 | #include 4 | int main() 5 | { 6 | int x = 0,y = 0; 7 | unsigned int squareSide = 0; 8 | printf("Enter size of square = "); 9 | scanf("%u",&squareSide); 10 | //outer loop 11 | for(x = 0; x < squareSide; ++x) 12 | { 13 | //inner loop 14 | for(y = 0; y < squareSide; ++y) 15 | { 16 | printf("*"); 17 | } 18 | printf("\n"); 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /C/stack_arr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define MAX 1000 3 | 4 | int main(){ 5 | int stack[MAX]; 6 | int size,ele,ch,top = -1; 7 | printf("Enter size of stack : "); 8 | scanf("%d",&size); 9 | while(1){ 10 | printf("\n\n0. Exit\n1. Push\n2. Pop\n3. Display\nEnter choice : "); 11 | scanf("%d",&ch); 12 | if(!ch) break; 13 | switch(ch){ 14 | case 1: 15 | printf("Enter element : "); 16 | scanf("%d",&ele); 17 | if(top < size-1){ 18 | top++; 19 | stack[top] = ele; 20 | } 21 | else printf("\nStack Overflow!\n"); 22 | break; 23 | case 2: 24 | if(top >-1){ 25 | printf("Popped element : %d",stack[top]); 26 | top--; 27 | } 28 | else printf("\nStack Underflow!\n"); 29 | break; 30 | case 3: 31 | if(top>-1){ 32 | for(ch = top; ch>-1;ch--){ 33 | if(ch==top) printf("%d <--top\n",stack[ch]); 34 | else printf("%d\n",stack[ch]); 35 | } 36 | } 37 | else printf("Empty stack!!!"); 38 | break; 39 | default: 40 | printf("\nWrong Choice!!!\n"); 41 | } 42 | } 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 |

✨Happy Hacktoberfest 2022✨

2 |

Hacktoberfest is a yearly event whiich encourages not only programmers and coders but also non-technical background to contribute in open source and start their journey with open source.

3 | 4 | # Message 5 |

Enter your Name, Github Link & Your E-Mail Address in the given format. Don't try to change anything else!!!

6 | | Name | Github Link | E-Mail Address | 7 | 8 | # List of Contributors 9 | 10 |

[*] Make sure you have updated your Name, Github link & E-Mail Id (enter your e-mail just after mailto:)!!!

11 |
12 | 13 | | Name | Github Link | Email ID | 14 | | ------|----------|---------- | 15 | | Adarsh Addee | Adarsh Addee | E-Mail | 16 | | Sarthak Roy | Sarthak Roy | E-Mail | 17 | | Suraj Bhandarkar S | Adarsh Addee | E-Mail | 18 | | Khushi Marothi | Khushi Marothi | E-Mail | 19 | | Aditya Giri | Aditya Giri | E-Mail | 20 | | KryPtoN | Kry9toN | E-Mail | 21 | | Udyansingh | Udyan Singh | E-Mail | 22 | | Hardik Pratap Singh | Hardik Pratap Singh | E-Mail | 23 | | Suraj Bhandarkar S | Adarsh Addee | E-Mail | 24 | | Ashutosh Shukla|Ashutosh Shukla|E-mail | 25 | | Amit Shinde | Amit Shinde | E-Mail | 26 | | Shubhanshu Jha | ShubhanshuJha | E-Mail | 27 | | Dhruv Bhagatkar| Dhruv Bhagatkar | E-Mail | 28 | | Kedar Solapure | Kedar Solapure | E-Mail | 29 | | Abhishek Krishna | Abhishek Krishna | E-Mail | 30 | | Aditya Wadkar | Aditya Wadkar | E-Mail | 31 | | Rahul Jangle | Ronny | E-Mail | 32 | | Anurag Vats | Anurag Vats | E-Mail | 33 | | Daksh Kesarwani | Daksh kesaarwani | E-Mail | 34 | | Vinay Pathak | Vinay Pathak | E-Mail | 35 | | Daksh Kesarwani | Daksh kesaarwani | E-Mail | 36 | | Aakash Jha | Aakash Jha | E-Mail | 37 | | Daksh Kesarwani | Daksh kesaarwani | E-Mail | 38 | | Atinder Kumar | Atinder Kumar | E-Mail | 39 | | Daksh Kesarwani | Daksh kesaarwani | E-Mail | 40 | | Shobhit Tiwari | Shobhit Tiwari | E-Mail | 41 | | Daksh Kesarwani | Daksh kesaarwani | E-Mail | 42 | | Aritroo Chowdhury | Aritroo Chowdhury | E-Mail | 43 | | Daksh Kesarwani | Daksh kesaarwani | E-Mail | 44 | | Kartikey Singh | Kartikey Singh | E-Mail | 45 | | Daksh Kesarwani | Daksh kesaarwani | E-Mail | 46 | | Pradeep Khatri | Pradeep Khatri | E-Mail | 47 | | Apurva Dubey | umbridge | E-Mail | 48 | | Daksh Kesarwani | Daksh kesaarwani | E-Mail | 49 | | Fikri Khairul Shaleh | Fikri Khairul Shaleh | E-Mail | 50 | | Shivam Jaiswal | Shivam Jaiswal | E-mail | 51 | | Ashish Kushwaha | Ashish Kushwaha | E-Mail | 52 | | Daksh Kesarwani | Daksh kesaarwani | E-Mail | 53 | | Chirag Chandnani | Chirag Chandnani | E-Mail | 54 | | Shivam Jaiswal | Shivam Jaiswal | E-mail | 55 | | Ashish Kushwaha | Ashish Kushwaha | E-Mail | 56 | | Dhruv Arora | Dhruv Arora | E-Mail | 57 | | Tharindu Sooriyaarchchi | E-Mail | 58 | | Samriddh Prasad | Samriddh Prasad | E-Mail | 59 | | Edgar Gonzalez | Edgar Gonzalez | E-Mail | 60 | | Amisha Rani | Amisha Rani | E-Mail | 61 | | Tharindu Sooriyaarchchi | E-Mail | 62 | | Samriddh Prasad | Samriddh Prasad | E-Mail | 63 | | Edgar Gonzalez | Edgar Gonzalez | E-Mail | 64 | | Sneha Chaudhary | Sneha Chaudhary | E-Mail | 65 | | Tharindu Sooriyaarchchi | E-Mail | 66 | | Samriddh Prasad | Samriddh Prasad | E-Mail | 67 | | Edgar Gonzalez | Edgar Gonzalez | E-Mail | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 |
91 |

92 | Happy Hacking ❤💻 93 |

94 | -------------------------------------------------------------------------------- /Dart/numbers.dart: -------------------------------------------------------------------------------- 1 | //Print 1 to 100 without using numbers 2 | void main() { 3 | int limite = int.parse("100"); 4 | for (int i = 1; i <= limite; i++) { 5 | print(i); 6 | } 7 | } -------------------------------------------------------------------------------- /Game/Rock_Paper_Scissors/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | 10 |
11 |

Challenge 3: Rock, Paper, Scissors

12 |
13 | 14 | 15 | 16 |
17 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /Game/Rock_Paper_Scissors/paper.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdarshAddee/Hacktoberfest2022_for_Beginers/8dfe2fe7d511f91ec2a9d3bee44843e5b7a136be/Game/Rock_Paper_Scissors/paper.jpg -------------------------------------------------------------------------------- /Game/Rock_Paper_Scissors/rock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdarshAddee/Hacktoberfest2022_for_Beginers/8dfe2fe7d511f91ec2a9d3bee44843e5b7a136be/Game/Rock_Paper_Scissors/rock.png -------------------------------------------------------------------------------- /Game/Rock_Paper_Scissors/scissors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdarshAddee/Hacktoberfest2022_for_Beginers/8dfe2fe7d511f91ec2a9d3bee44843e5b7a136be/Game/Rock_Paper_Scissors/scissors.png -------------------------------------------------------------------------------- /Game/Rock_Paper_Scissors/script.js: -------------------------------------------------------------------------------- 1 | function rps_game(yourchoice){ 2 | console.log(yourchoice); 3 | var humanChoice, botChoice; 4 | humanChoice = yourchoice.id; 5 | botChoice = numberToChoice(randToRpsInt()); 6 | console.log(botChoice); 7 | var results = decidewinner(humanChoice,botChoice); 8 | console.log(results); 9 | var message = finalmessage(results); 10 | console.log(message); 11 | frontend(yourchoice.id,botChoice,message); 12 | 13 | } 14 | 15 | function randToRpsInt(){ 16 | return Math.floor(Math.random() * 3); 17 | } 18 | 19 | function numberToChoice(number){ 20 | return ['rock','paper','scissors'][number]; 21 | } 22 | 23 | function decidewinner(humanChoice,botChoice){ 24 | var rpsdatabase = { 25 | 'rock':{'scissors':1 , 'rock':0.5, 'paper':0}, 26 | 'paper':{'rock':1 , 'paper':0.5, 'scissors':0}, 27 | 'scissors':{'paper':1 , 'scissors':0.5, 'rock':0} 28 | }; 29 | 30 | var yourscore = rpsdatabase[humanChoice][botChoice]; 31 | var botscore = rpsdatabase[botChoice][humanChoice]; 32 | 33 | return [yourscore,botscore]; 34 | } 35 | 36 | function finalmessage([yourscore,botscore]){ 37 | if(yourscore === 0){ 38 | return {'message':'You Lost!!','color':'red'}; 39 | } 40 | else if(yourscore === 0.5){ 41 | return {'message':'You tied!!','color':'yellow'}; 42 | } 43 | else { 44 | return {'message':'You Won!!','color':'green'}; 45 | } 46 | } 47 | 48 | function frontend(humanImageChoice,botImageChoice,finalmessage){ 49 | var imagesdatabase = { 50 | 'rock': document.getElementById('rock').src, 51 | 'paper': document.getElementById('paper').src, 52 | 'scissors': document.getElementById('scissors').src 53 | } 54 | 55 | document.getElementById('rock').remove(); 56 | document.getElementById('paper').remove(); 57 | document.getElementById('scissors').remove(); 58 | 59 | var humanDiv = document.createElement('div'); 60 | var botDiv = document.createElement('div'); 61 | var messageDiv = document.createElement('div'); 62 | 63 | humanDiv.innerHTML = ""; 64 | document.getElementById('flex-box-rps-div').appendChild(humanDiv); 65 | 66 | messageDiv.innerHTML = "

"+ finalmessage['message'] +"

" 67 | document.getElementById('flex-box-rps-div').appendChild(messageDiv); 68 | 69 | botDiv.innerHTML = " "; 70 | document.getElementById('flex-box-rps-div').appendChild(botDiv); 71 | 72 | 73 | } 74 | -------------------------------------------------------------------------------- /Game/Rock_Paper_Scissors/style.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background-color: lightgray ; 3 | } 4 | 5 | .container{ 6 | border: 1px solid black; 7 | width: 75%; 8 | margin: 0 auto; 9 | text-align: center; 10 | } 11 | 12 | .flex-box-rps{ 13 | display: flex; 14 | padding: 10px; 15 | flex-wrap: wrap; 16 | border: 1px solid black; 17 | flex-direction: row; 18 | justify-content: space-around; 19 | } 20 | 21 | .flex-box-rps img:hover{ 22 | box-shadow: 0px 10px 50px rgba(37, 50, 233, 1); 23 | } -------------------------------------------------------------------------------- /Game/game.txt: -------------------------------------------------------------------------------- 1 | Namaste 🙏 Bharat! 2 | 3 | Submit your game here 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /HTML/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Namaste Bharat 5 | 6 | 7 | 8 | Namaste 🙏 Bharat! 9 | 10 | 11 | -------------------------------------------------------------------------------- /HTML/navbar.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bootstrap demo 7 | 8 | 9 | 10 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Java/CodeChef/q1.java: -------------------------------------------------------------------------------- 1 | // solution to problem : https://www.codechef.com/submit/NEWPIECE 2 | 3 | 4 | import java.util.*; 5 | import java.lang.*; 6 | import java.io.*; 7 | 8 | class Codechef 9 | { 10 | public static void main (String[] args) throws java.lang.Exception 11 | { 12 | // your code goes here 13 | Scanner sc = new Scanner(System.in); 14 | int t=sc.nextInt(); 15 | while(t-->0){ 16 | int x = sc.nextInt(); 17 | int y = sc.nextInt(); 18 | int p = sc.nextInt(); 19 | int q = sc.nextInt(); 20 | if(x==p && y==q) 21 | System.out.println(0); 22 | else if((x+y)%2==(p+q)%2) 23 | System.out.println(2); 24 | else System.out.println(1); 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /Java/CountingTheNumberOfPathsToReachFrom1ToN.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Google Online Coding Challenge: Counting paths 3 | * You are given a matrix A having N rows and M columns. The rows are numbered 1 to N from top to bottom and columns are 4 | * numbered 1 to M from left to right. You are allowed to move right and down only, i.e., if you are at cell (i,j), then 5 | * you can move to (i+1, j) and (i, j+1). You are not allowed to move outside the matrix. 6 | * Your task is to find the number of good paths starting from (1, 1) and ending at (N, M). 7 | * Good Path: If the sum of all elements that lie in the path is divisible by K, then the path is considered as good. 8 | * 9 | * @author: ShubhanshuJha 10 | * 11 | **/ 12 | 13 | import java.io.*; 14 | import java.util.Set; 15 | import java.util.HashSet; 16 | import java.util.Scanner; 17 | 18 | public class CountingTheNumberOfPathsToReachFrom1ToN { 19 | public static void main(String[] args) throws IOException{ 20 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 21 | Scanner sc = new Scanner(System.in); 22 | 23 | int testCase = Integer.parseInt(br.readLine()); 24 | while(testCase-- > 0){ 25 | long n = Long.parseLong(br.readLine()); 26 | long m = Long.parseLong(br.readLine()); 27 | long a[][] = new long[(int)n][(int)m]; 28 | for (int i = 0; i < (int)n; i++) { 29 | for (int j = 0; j < (int)m; j++) { 30 | a[i][j] = sc.nextLong(); 31 | } 32 | } 33 | long k = Long.parseLong(br.readLine()); 34 | printMat(a); 35 | long res = paths(a, n, m); 36 | System.out.println(res); 37 | } 38 | } 39 | static void printMat(long[][] m){ 40 | for (int i = 0; i < m.length; i++) { 41 | for (int j = 0; j < m[0].length; j++) { 42 | System.out.print(m[i][j]+" "); 43 | } 44 | System.out.println(); 45 | } 46 | } 47 | private static long paths(long a[][], long N, long M){ 48 | if (a[(int)N][(int)M] == 1 || a[(int)N][(int)M] == 1) { 49 | return 1; 50 | } 51 | return paths(a, N, M-1) + paths(a, M, N-1); 52 | } 53 | } -------------------------------------------------------------------------------- /Java/InsertionSort.java: -------------------------------------------------------------------------------- 1 | /*Tharindu Sooriyaarachchi - https://github.com/TharinduDilshan */ 2 | public class InsertionSort 3 | { 4 | void insert(int a[]) 5 | { 6 | int i, j, temp; 7 | int n = a.length; 8 | for (i = 1; i < n; i++) { 9 | temp = a[i]; 10 | j = i - 1; 11 | 12 | while(j>=0 && temp <= a[j]) 13 | { 14 | a[j+1] = a[j]; 15 | j = j-1; 16 | } 17 | a[j+1] = temp; 18 | } 19 | } 20 | void printArr(int a[]) 21 | { 22 | int i; 23 | int n = a.length; 24 | for (i = 0; i < n; i++) 25 | System.out.print(a[i] + " "); 26 | } 27 | 28 | public static void main(String[] args) { 29 | int a[] = { 92, 50, 5, 20, 11, 22 }; 30 | InsertionSort i1 = new InsertionSort(); 31 | System.out.println("\nBefore sorting array elements are - "); 32 | i1.printArr(a); 33 | i1.insert(a); 34 | System.out.println("\n\nAfter sorting array elements are - "); 35 | i1.printArr(a); 36 | System.out.println(); 37 | } 38 | } -------------------------------------------------------------------------------- /Java/OccurenceOfCharInString.java: -------------------------------------------------------------------------------- 1 | // Java program to count frequencies of 2 | // characters in string using Hashmap 3 | 4 | class OccurenceOfCharInString { 5 | static void characterCount(String inputString) 6 | { 7 | // Creating a HashMap containing char 8 | // as a key and occurrences as a value 9 | HashMap charCountMap 10 | = new HashMap(); 11 | 12 | // Converting given string to char array 13 | 14 | char[] strArray = inputString.toCharArray(); 15 | 16 | // checking each char of strArray 17 | for (char c : strArray) { 18 | if (charCountMap.containsKey(c)) { 19 | 20 | // If char is present in charCountMap, 21 | // incrementing it's count by 1 22 | charCountMap.put(c, charCountMap.get(c) + 1); 23 | } 24 | else { 25 | 26 | // If char is not present in charCountMap, 27 | // putting this char to charCountMap with 1 as it's value 28 | charCountMap.put(c, 1); 29 | } 30 | } 31 | 32 | // Printing the charCountMap 33 | for (Map.Entry entry : charCountMap.entrySet()) { 34 | System.out.println(entry.getKey() + " " + entry.getValue()); 35 | } 36 | } 37 | 38 | // Driver Code 39 | public static void main(String[] args) 40 | { 41 | String str = "Ajit"; 42 | characterCount(str); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Java/QuickSort.java: -------------------------------------------------------------------------------- 1 | //Github Username: Udyansingh 2 | 3 | import java.util.Arrays; 4 | import java.util.Scanner; 5 | 6 | public class QuickSort { 7 | 8 | public static int partition(int[] arr, int si, int ei) { 9 | int pid, piv = arr[si], count = 0, i = si; 10 | for (i = si + 1; i <= ei; i++) { 11 | if (arr[i] <= piv) { 12 | count++; 13 | } 14 | } 15 | pid = count + si; 16 | arr[si] = (arr[pid] + arr[si]) - (arr[pid] = arr[si]); 17 | while (si < pid && ei > pid) { 18 | if (arr[si] < piv) { 19 | si++; 20 | } else if (arr[ei] > piv) { 21 | ei--; 22 | } else { 23 | arr[si] = (arr[ei] + arr[si]) - (arr[ei--] = arr[si++]); 24 | } 25 | } 26 | return pid; 27 | } 28 | 29 | public static void quickSort(int[] arr, int si, int ei) { 30 | if (si < ei) { 31 | int p = partition(arr, si, ei); 32 | quickSort(arr, si, p - 1); 33 | quickSort(arr, p + 1, ei); 34 | } 35 | } 36 | 37 | public static void main(String[] args) { 38 | Scanner sc = new Scanner(System.in).useDelimiter(","); 39 | System.out.println("Hint: Enter Array -> 1,2,3,4,5,6 "); 40 | System.out.print("Enter Array -> "); 41 | String input = sc.nextLine(); 42 | String[] split = input.split(","); 43 | int[] arr = new int[split.length]; 44 | for (int i = 0; i < split.length; i++) { 45 | arr[i] = Integer.parseInt(split[i]); 46 | } 47 | quickSort(arr, 0, arr.length - 1); 48 | System.out.println("Sorted Array -> " + Arrays.toString(arr)); 49 | sc.close(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Java/convert-Binary_Tree-to-Binary_Search_Tree/InnocentDaksh63.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | public class ConvertBTtoBST { 4 | 5 | //Represent a node of binary tree 6 | public static class Node{ 7 | int data; 8 | Node left; 9 | Node right; 10 | 11 | public Node(int data){ 12 | //Assign data to the new node, set left and right children to null 13 | this.data = data; 14 | this.left = null; 15 | this.right = null; 16 | } 17 | } 18 | 19 | //Represent the root of binary tree 20 | public Node root; 21 | 22 | int[] treeArray; 23 | int index = 0; 24 | 25 | public ConvertBTtoBST(){ 26 | root = null; 27 | } 28 | 29 | //convertBTBST() will convert a binary tree to binary search tree 30 | public Node convertBTBST(Node node) { 31 | 32 | //Variable treeSize will hold size of tree 33 | int treeSize = calculateSize(node); 34 | treeArray = new int[treeSize]; 35 | 36 | //Converts binary tree to array 37 | convertBTtoArray(node); 38 | 39 | //Sort treeArray 40 | Arrays.sort(treeArray); 41 | 42 | //Converts array to binary search tree 43 | Node d = createBST(0, treeArray.length -1); 44 | return d; 45 | } 46 | 47 | //calculateSize() will calculate size of tree 48 | public int calculateSize(Node node) 49 | { 50 | int size = 0; 51 | if (node == null) 52 | return 0; 53 | else { 54 | size = calculateSize (node.left) + calculateSize (node.right) + 1; 55 | return size; 56 | } 57 | } 58 | 59 | //convertBTtoArray() will convert the given binary tree to its corresponding array representation 60 | public void convertBTtoArray(Node node) { 61 | //Check whether tree is empty 62 | if(root == null){ 63 | System.out.println("Tree is empty"); 64 | return; 65 | } 66 | else { 67 | if(node.left != null) 68 | convertBTtoArray(node.left); 69 | //Adds nodes of binary tree to treeArray 70 | treeArray[index] = node.data; 71 | index++; 72 | if(node.right != null) 73 | convertBTtoArray(node.right); 74 | } 75 | } 76 | 77 | //createBST() will convert array to binary search tree 78 | public Node createBST(int start, int end) { 79 | 80 | //It will avoid overflow 81 | if (start > end) { 82 | return null; 83 | } 84 | 85 | //Variable will store middle element of array and make it root of binary search tree 86 | int mid = (start + end) / 2; 87 | Node node = new Node(treeArray[mid]); 88 | 89 | //Construct left subtree 90 | node.left = createBST(start, mid - 1); 91 | 92 | //Construct right subtree 93 | node.right = createBST(mid + 1, end); 94 | 95 | return node; 96 | } 97 | 98 | //inorder() will perform inorder traversal on binary search tree 99 | public void inorderTraversal(Node node) { 100 | 101 | //Check whether tree is empty 102 | if(root == null){ 103 | System.out.println("Tree is empty"); 104 | return; 105 | } 106 | else { 107 | 108 | if(node.left!= null) 109 | inorderTraversal(node.left); 110 | System.out.print(node.data + " "); 111 | if(node.right!= null) 112 | inorderTraversal(node.right); 113 | 114 | } 115 | } 116 | 117 | public static void main(String[] args) { 118 | 119 | ConvertBTtoBST bt = new ConvertBTtoBST(); 120 | //Add nodes to the binary tree 121 | bt.root = new Node(1); 122 | bt.root.left = new Node(2); 123 | bt.root.right = new Node(3); 124 | bt.root.left.left = new Node(4); 125 | bt.root.left.right = new Node(5); 126 | bt.root.right.left = new Node(6); 127 | bt.root.right.right = new Node(7); 128 | 129 | //Display given binary tree 130 | System.out.println("Inorder representation of binary tree: "); 131 | bt.inorderTraversal(bt.root); 132 | 133 | //Converts binary tree to corresponding binary search tree 134 | Node bst = bt.convertBTBST(bt.root); 135 | 136 | //Display corresponding binary search tree 137 | System.out.println("\nInorder representation of resulting binary search tree: "); 138 | bt.inorderTraversal(bst); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /Java/main.java: -------------------------------------------------------------------------------- 1 | class main{ 2 | public static void main(String args[]){ 3 | System.out.println("Namaste Bharat"); 4 | } 5 | ) 6 | -------------------------------------------------------------------------------- /Javascript/main.js: -------------------------------------------------------------------------------- 1 | console.log("Namaste Bharat"); 2 | -------------------------------------------------------------------------------- /Javascript/print 1 to 100 without numbers.js: -------------------------------------------------------------------------------- 1 | // Suraj-Bhandarkar-S 2 | 3 | let limit = "..........".length; 4 | 5 | for(let i = ".".length;i <= (limit * limit);i++){ 6 | console.log(i); 7 | } 8 | 9 | // to run the file in vscode: node '.\print 1 to 100 without numbers.js' 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Adarsh Addee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PHP/main.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /PHP/stringReverser.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | String Reverser 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 |

21 | 22 |
23 | 24 | -------------------------------------------------------------------------------- /Python/BlackjackCapstoneGame.py: -------------------------------------------------------------------------------- 1 | # Contributed by AnuragVats007 2 | 3 | # Blackjack Capstone Game 4 | import random as r 5 | def BlackJack(): 6 | print() 7 | deck = [11,2,3,4,5,6,7,8,9,10,10,10,10,11,2,3,4,5,6,7,8,9,10,10,10,10,11,2,3,4,5,6,7,8,9,10,10,10,10,11,2,3,4,5,6,7,8,9,10,10,10,10] 8 | comp_cards = [] 9 | your_cards = [] 10 | r.shuffle(deck) 11 | comp_cards.append(r.choice(deck)) 12 | r.shuffle(deck) 13 | comp_cards.append(r.choice(deck)) 14 | r.shuffle(deck) 15 | your_cards.append(r.choice(deck)) 16 | r.shuffle(deck) 17 | your_cards.append(r.choice(deck)) 18 | sum = 0 19 | comp_sum = 0 20 | for i in your_cards: 21 | sum += i 22 | for i in comp_cards: 23 | comp_sum += i 24 | print(f"your cards: {your_cards}") 25 | print(f"computer's first card: {comp_cards[0]}") 26 | fl = True 27 | while fl: 28 | ch = input("Type 'y' to get another card or type 'n' to pass: ") 29 | if ch=='y': 30 | r.shuffle(deck) 31 | your_cards.append(r.choice(deck)) 32 | sum+=your_cards[2] 33 | print(f"your cards: {your_cards}") 34 | else: 35 | fl = False 36 | if sum>21: 37 | fl = False 38 | if comp_sum<17: 39 | r.shuffle(deck) 40 | comp_cards.append(r.choice(deck)) 41 | comp_sum+=comp_cards[2] 42 | print(f"Your cards: {your_cards}") 43 | print(f"Computer's cards: {comp_cards}") 44 | print(f"Your total: {sum}") 45 | print(f"Computer's total: {comp_sum}") 46 | 47 | if sum>21: 48 | print("\n >>> YOU LOSE!!!") 49 | elif comp_sum>21: 50 | print("\n >>> YOU WON!!!") 51 | elif sum>> YOU LOSE!!!") 53 | elif sum>comp_sum: 54 | print("\n >>> YOU WON!!!") 55 | else: 56 | print("\n >>> ITS A DRAW!!!") 57 | 58 | def main(): 59 | flag = True 60 | while flag: 61 | choice = input("Do you want to play BlackJack/21 ?(y/n): ") 62 | if choice=='y': 63 | BlackJack() 64 | else: 65 | flag = False 66 | 67 | main() 68 | -------------------------------------------------------------------------------- /Python/Calculator without operators.py: -------------------------------------------------------------------------------- 1 | # AdrshCode 2 | 3 | print(eval(input())) 4 | 5 | -------------------------------------------------------------------------------- /Python/GUI_calculator.py: -------------------------------------------------------------------------------- 1 | ## github username:- AdityaWadkar 2 | # This project is of gui calculator which is created using tkinter in only 50 lines. 3 | """ 4 | Step to run: 5 | prerequisite : python of version 3 or above should be installed in your system 6 | 1. copy-Paste or download this file in code editor. 7 | 2. run the file to see calculator . 8 | """ 9 | 10 | from tkinter import * 11 | import tkinter.messagebox as t 12 | a,y,yz,aw=0,70,"red","pink" 13 | def click(event): 14 | global s 15 | text = event.widget.cget("text") 16 | if text == "=": 17 | a=s.get() 18 | if "^" in s.get(): 19 | a=a.replace("^","**") 20 | if "x" in s.get(): 21 | a=a.replace("x","**") 22 | try: 23 | value=eval(a) 24 | s.set(value) 25 | screen.update() 26 | except Exception as e: 27 | t.showerror("Error!!","Please select 2 numbers") 28 | print(e) 29 | elif text =="C": 30 | s.set("") 31 | screen.update() 32 | else: 33 | s.set(s.get()+text) 34 | screen.update() 35 | root=Tk() 36 | root.geometry("335x420") 37 | root.title("Calculator") 38 | root.config(bg="#FFDEAD") 39 | root.wm_iconbitmap("calculate.ico") 40 | s=StringVar() 41 | s.set("") 42 | screen =Entry(root,textvar=s, font="verdena 20 bold",justify=RIGHT) 43 | screen.pack(pady=10) 44 | text = ("7", "8", "9", "C", "4", "5", "6", "+", "1", "2", "3", "-", "^", "0", ".", "x") 45 | def button (text,l,m): 46 | if text =="-" or text == "." or text=="/": 47 | f=9 48 | else: 49 | f=6 50 | b = Button(root,text=text, font="lucida 20 bold", padx=f, pady=0,activeforeground=yz,bg=aw) 51 | b.place(x=l,y=m) 52 | b.bind("", click) 53 | for m in range(4): 54 | x=27 55 | for l in range (4): 56 | button(text[a],x,y) 57 | a=a+1 58 | x=x+80 59 | y=y+70 60 | b = Button(root,text="/", font="lucida 20 bold", width=3, height=1,activeforeground=yz,bg=aw) 61 | b.place(x=267,y=350) 62 | b.bind("", click) 63 | b = Button(root,text="=", font="lucida 20 bold", width=13, height=1,activeforeground=yz,bg=aw) 64 | b.place(x=23,y=350) 65 | b.bind("", click) 66 | root.mainloop() 67 | -------------------------------------------------------------------------------- /Python/Numberpattern.py: -------------------------------------------------------------------------------- 1 | num = 1 2 | n = int(input("Enter the number of rows you want:")) 3 | for i in range(n): 4 | for j in range(i+1): 5 | print(num,end="") 6 | num = num + 1 7 | num = 1 8 | print() 9 | -------------------------------------------------------------------------------- /Python/Print 1 to 100 without numbers.py: -------------------------------------------------------------------------------- 1 | zero = int(False) 2 | one = int(True) 3 | hundred = int(f"{one}{zero}{zero}") 4 | 5 | 6 | def shownum(i): 7 | if i <= hundred: 8 | print(i) 9 | shownum(i + one) 10 | 11 | 12 | shownum(one) 13 | -------------------------------------------------------------------------------- /Python/QuickSort.py: -------------------------------------------------------------------------------- 1 | # anupkafle 2 | 3 | def partition(A, low, high): 4 | pivot = A[low] 5 | i = low + 1 6 | j = high 7 | while True: 8 | while i <= j and A[i] <= pivot: 9 | i = i + 1 10 | while i <=j and A[j] > pivot: 11 | j = j - 1 12 | if i <= j: 13 | A[i], A[j] = A[j], A[i] 14 | else: 15 | break 16 | A[low], A[j] = A[j], A[low] 17 | return j 18 | 19 | 20 | def quicksort(A, low, high): 21 | if low < high: 22 | pi = partition(A, low, high) 23 | quicksort(A, low, pi - 1) 24 | quicksort(A, pi + 1, high) 25 | 26 | 27 | 28 | A = [6, 20, 815, 94, 651, 28] 29 | print('Original Array:',A) 30 | quicksort(A, 0, len(A)-1) 31 | print('Sorted Array:',A) 32 | 33 | -------------------------------------------------------------------------------- /Python/RadixSort.py: -------------------------------------------------------------------------------- 1 | # anupkafle 2 | 3 | def radixsort(A): 4 | n = len(A) 5 | maxelement = max(A) 6 | digits = len(str(maxelement)) 7 | l = [] 8 | bins = [l] * 10 9 | for i in range(digits): 10 | for j in range(n): 11 | e = int((A[j] / pow(10, i)) % 10) 12 | if len(bins[e]) > 0: 13 | bins[e].append(A[j]) 14 | else: 15 | bins[e] = [A[j]] 16 | k = 0 17 | for x in range(10): 18 | if len(bins[x]) > 0: 19 | for y in range(len(bins[x])): 20 | A[k] = bins[x].pop(0) 21 | k = k + 1 22 | 23 | 24 | A = [6, 20, 815, 94, 651, 28] 25 | print('Original Array:',A) 26 | radixsort(A) 27 | print('Sorted Array:',A) 28 | -------------------------------------------------------------------------------- /Python/Steganography.py: -------------------------------------------------------------------------------- 1 | # Shivamsinghal679 2 | 3 | import cv2 4 | import numpy as np 5 | import types 6 | from google.colab.patches import cv2_imshow 7 | 8 | # converting types to binary 9 | def msg_to_bin(msg): 10 | if type(msg) == str: 11 | return ''.join([format(ord(i), "08b") for i in msg]) 12 | elif type(msg) == bytes or type(msg) == np.ndarray: 13 | return [format(i, "08b") for i in msg] 14 | elif type(msg) == int or type(msg) == np.uint8: 15 | return format(msg, "08b") 16 | else: 17 | raise TypeError("Input type not supported") 18 | 19 | # defining function to hide the secret message into the image 20 | def hide_data(img, secret_msg): 21 | # calculating the maximum bytes for encoding 22 | nBytes = img.shape[0] * img.shape[1] * 3 // 8 23 | print("Maximum Bytes for encoding:", nBytes) 24 | # checking whether the number of bytes for encoding is less 25 | # than the maximum bytes in the image 26 | if len(secret_msg) > nBytes: 27 | raise ValueError("Error encountered insufficient bytes, need bigger image or less data!!") 28 | secret_msg += '#####' # we can utilize any string as the delimiter 29 | dataIndex = 0 30 | # converting the input data to binary format using the msg_to_bin() function 31 | bin_secret_msg = msg_to_bin(secret_msg) 32 | 33 | # finding the length of data that requires to be hidden 34 | dataLen = len(bin_secret_msg) 35 | for values in img: 36 | for pixels in values: 37 | # converting RGB values to binary format 38 | r, g, b = msg_to_bin(pixels) 39 | # modifying the LSB only if there is data remaining to store 40 | if dataIndex < dataLen: 41 | # hiding the data into LSB of Red pixel 42 | pixels[0] = int(r[:-1] + bin_secret_msg[dataIndex], 2) 43 | dataIndex += 1 44 | if dataIndex < dataLen: 45 | # hiding the data into LSB of Green pixel 46 | pixels[1] = int(g[:-1] + bin_secret_msg[dataIndex], 2) 47 | dataIndex += 1 48 | if dataIndex < dataLen: 49 | # hiding the data into LSB of Blue pixel 50 | pixels[2] = int(b[:-1] + bin_secret_msg[dataIndex], 2) 51 | dataIndex += 1 52 | # if data is encoded, break out the loop 53 | if dataIndex >= dataLen: 54 | break 55 | 56 | return img 57 | 58 | def show_data(img): 59 | bin_data = "" 60 | for values in img: 61 | for pixels in values: 62 | # converting the Red, Green, Blue values into binary format 63 | r, g, b = msg_to_bin(pixels) 64 | # data extraction from the LSB of Red pixel 65 | bin_data += r[-1] 66 | # data extraction from the LSB of Green pixel 67 | bin_data += g[-1] 68 | # data extraction from the LSB of Blue pixel 69 | bin_data += b[-1] 70 | # split by 8-Bits 71 | allBytes = [bin_data[i: i + 8] for i in range(0, len(bin_data), 8)] 72 | # converting from bits to characters 73 | decodedData = "" 74 | for bytes in allBytes: 75 | decodedData += chr(int(bytes, 2)) 76 | # checking if we have reached the delimiter which is "#####" 77 | if decodedData[-5:] == "#####": 78 | break 79 | # print(decodedData) 80 | # removing the delimiter to display the actual hidden message 81 | return decodedData[:-5] 82 | 83 | # defining function to encode data into Image 84 | def encodeText(): 85 | img_name = input("Enter image name (with extension): ") 86 | # reading the input image using OpenCV-Python 87 | img = cv2.imread(img_name) 88 | 89 | # printing the details of the image 90 | print("The shape of the image is: ", img.shape) # checking the image shape to calculate the number of bytes in it 91 | print("The original image is as shown below: ") 92 | # resizing the image as per the need 93 | resizedImg = cv2.resize(img, (500, 500)) 94 | # displaying the image 95 | cv2_imshow(resizedImg) 96 | 97 | data = input("Enter data to be encoded: ") 98 | if (len(data) == 0): 99 | raise ValueError('Data is Empty') 100 | 101 | file_name = input("Enter the name of the new encoded image (with extension): ") 102 | # calling the hide_data() function to hide the secret message into the selected image 103 | encodedImage = hide_data(img, data) 104 | cv2.imwrite(file_name, encodedImage) 105 | 106 | # defining the function to decode the data in the image 107 | def decodeText(): 108 | # reading the image containing the hidden image 109 | img_name = input("Enter the name of the Steganographic image that has to be decoded (with extension): ") 110 | img = cv2.imread(img_name) # reading the image using the imread() function 111 | 112 | print("The Steganographic image is as follow: ") 113 | resizedImg = cv2.resize(img, (500, 500)) # resizing the actual image as per the needs 114 | cv2_imshow(resizedImg) # displaying the Steganographic image 115 | 116 | text = show_data(img) 117 | return text 118 | 119 | # image steganography 120 | def steganography(): 121 | n = int(input("Image Steganography \n1. Encode the data \n2. Decode the data \n Select the option: ")) 122 | if (n == 1): 123 | print("\nEncoding...") 124 | encodeText() 125 | 126 | elif (n == 2): 127 | print("\nDecoding...") 128 | print("Decoded message is " + decodeText()) 129 | 130 | else: 131 | raise Exception("Inserted value is incorrect!") 132 | 133 | steganography() 134 | -------------------------------------------------------------------------------- /Python/character_pattern.py: -------------------------------------------------------------------------------- 1 | # Python program to generate a character pattern 2 | 3 | # Github Username : aritroo 4 | 5 | #Example Output is given below :- 6 | # Enter the number of rows : 5 7 | # A 8 | # B B 9 | # C C C 10 | # D D D D 11 | # E E E E E 12 | 13 | 14 | 15 | def character(n): 16 | 17 | num = 65 18 | 19 | for i in range(0, n): 20 | 21 | for j in range(0, i+1): 22 | 23 | ch = chr(num) 24 | 25 | print(ch, end=" ") 26 | 27 | num = num + 1 28 | 29 | print("\r") 30 | 31 | n = int(input("Enter the number of rows : ")) 32 | character(n) 33 | -------------------------------------------------------------------------------- /Python/checkpass.py: -------------------------------------------------------------------------------- 1 | # AkashShaw27 2 | 3 | 4 | import requests 5 | import hashlib 6 | import sys 7 | def request_api_data(query_char): 8 | url="https://api.pwnedpasswords.com/range/" + query_char 9 | res=requests.get(url) 10 | if res.status_code !=200: 11 | raise RuntimeError(f'Error fetching: {res.status_code}, check the api and try again') 12 | return res 13 | def get_password_leaks_count(hashes, hash_to_check): 14 | hashes=(line.split(':') for line in hashes.text.splitlines()) 15 | for h, count in hashes: 16 | if h==hash_to_check: 17 | return count 18 | return 0 19 | def pwned_api_check(password): 20 | sha1password=hashlib.sha1(password.encode('utf-8')).hexdigest().upper() 21 | first5_char, tail=sha1password[:5],sha1password[5:] 22 | response=request_api_data(first5_char) 23 | return get_password_leaks_count(response,tail) 24 | #Check password if it exists in API response 25 | def main(args): 26 | for password in args: 27 | count=pwned_api_check(password) 28 | if count: 29 | print(f'{password} was found {count} times... You should probably change your password') 30 | else: 31 | print(f'{password} was NOT found. Carry on!') 32 | return 'done!' 33 | if __name__=='__main__': 34 | main(sys.argv[1:]) 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Python/common_factor.py: -------------------------------------------------------------------------------- 1 | # defining a function to calculate HCF 2 | def calculate_hcf(x, y): 3 | # selecting the smaller number 4 | if x > y: 5 | smaller = y 6 | else: 7 | smaller = x 8 | for i in range(1,smaller + 1): 9 | if((x % i == 0) and (y % i == 0)): 10 | hcf = i 11 | return hcf 12 | 13 | # taking input from users 14 | num1 = int(input("Enter first number: ")) 15 | num2 = int(input("Enter second number: ")) 16 | # printing the result for the users 17 | print("The H.C.F. of", num1,"and", num2,"is", calculate_hcf(num1, num2)) 18 | -------------------------------------------------------------------------------- /Python/hangman.py: -------------------------------------------------------------------------------- 1 | import random #dhruv2003 2 | from words import word_list 3 | 4 | 5 | def get_word(): 6 | word = random.choice(word_list) 7 | return word.upper() 8 | 9 | 10 | def play(word): 11 | word_completion = "_" * len(word) 12 | guessed = False 13 | guessed_letters = [] 14 | guessed_words = [] 15 | tries = 6 16 | print("Let's play Hangman!") 17 | print(display_hangman(tries)) 18 | print(word_completion) 19 | print("\n") 20 | while not guessed and tries > 0: 21 | guess = input("Please guess a letter or word: ").upper() 22 | if len(guess) == 1 and guess.isalpha(): 23 | if guess in guessed_letters: 24 | print("You already guessed the letter", guess) 25 | elif guess not in word: 26 | print(guess, "is not in the word.") 27 | tries -= 1 28 | guessed_letters.append(guess) 29 | else: 30 | print("Good job,", guess, "is in the word!") 31 | guessed_letters.append(guess) 32 | word_as_list = list(word_completion) 33 | indices = [i for i, letter in enumerate(word) if letter == guess] 34 | for index in indices: 35 | word_as_list[index] = guess 36 | word_completion = "".join(word_as_list) 37 | if "_" not in word_completion: 38 | guessed = True 39 | elif len(guess) == len(word) and guess.isalpha(): 40 | if guess in guessed_words: 41 | print("You already guessed the word", guess) 42 | elif guess != word: 43 | print(guess, "is not the word.") 44 | tries -= 1 45 | guessed_words.append(guess) 46 | else: 47 | guessed = True 48 | word_completion = word 49 | else: 50 | print("Not a valid guess.") 51 | print(display_hangman(tries)) 52 | print(word_completion) 53 | print("\n") 54 | if guessed: 55 | print("Congrats, you guessed the word! You win!") 56 | else: 57 | print("Sorry, you ran out of tries. The word was " + word + ". Maybe next time!") 58 | 59 | 60 | def display_hangman(tries): 61 | stages = [ # final state: head, torso, both arms, and both legs 62 | """ 63 | -------- 64 | | | 65 | | O 66 | | \\|/ 67 | | | 68 | | / \\ 69 | - 70 | """, 71 | # head, torso, both arms, and one leg 72 | """ 73 | -------- 74 | | | 75 | | O 76 | | \\|/ 77 | | | 78 | | / 79 | - 80 | """, 81 | # head, torso, and both arms 82 | """ 83 | -------- 84 | | | 85 | | O 86 | | \\|/ 87 | | | 88 | | 89 | - 90 | """, 91 | # head, torso, and one arm 92 | """ 93 | -------- 94 | | | 95 | | O 96 | | \\| 97 | | | 98 | | 99 | - 100 | """, 101 | # head and torso 102 | """ 103 | -------- 104 | | | 105 | | O 106 | | | 107 | | | 108 | | 109 | - 110 | """, 111 | # head 112 | """ 113 | -------- 114 | | | 115 | | O 116 | | 117 | | 118 | | 119 | - 120 | """, 121 | # initial empty state 122 | """ 123 | -------- 124 | | | 125 | | 126 | | 127 | | 128 | | 129 | - 130 | """ 131 | ] 132 | return stages[tries] 133 | 134 | 135 | def main(): 136 | word = get_word() 137 | play(word) 138 | while input("Play Again? (Y/N) ").upper() == "Y": 139 | word = get_word() 140 | play(word) 141 | 142 | 143 | if __name__ == "__main__": 144 | main() -------------------------------------------------------------------------------- /Python/hourglass_pattern.py: -------------------------------------------------------------------------------- 1 | ### Github Username - SanBuilds (https://github.com/SanBuilds) 2 | ### Hourglass pattern in python 3 | 4 | rows = int(input("Enter the rows(height) of the hourglass: ")) 5 | 6 | for i in range(rows): 7 | for j in range(i): 8 | print('', end = ' ') 9 | for k in range(i,rows): 10 | print('*', end = ' ') 11 | print() 12 | 13 | for i in range(rows,-1,-1): 14 | for j in range(i): 15 | print('', end = ' ') 16 | for k in range(i,rows): 17 | print('*', end = ' ') 18 | print() 19 | -------------------------------------------------------------------------------- /Python/loading_on_python.py: -------------------------------------------------------------------------------- 1 | # Kry9toN 2 | 3 | import itertools 4 | import threading 5 | import sys 6 | import time 7 | 8 | loading = True 9 | 10 | def animate(): 11 | for c in itertools.cycle(['🌑', '🌒', '🌓', '🌔', '🌕', '🌖', '🌗', '🌘']): 12 | if not loading: 13 | break 14 | sys.stdout.write('\rLOADING ' + c) 15 | sys.stdout.flush() 16 | time.sleep(0.1) 17 | 18 | def count(number): 19 | result = 0 20 | for n in range(number): 21 | result += 1 22 | time.sleep(0.0001) 23 | print() 24 | return result 25 | 26 | if __name__ == '__main__': 27 | t = threading.Thread(target=animate) 28 | t.start() 29 | print(count(10000)) 30 | loading = False 31 | t.join() 32 | -------------------------------------------------------------------------------- /Python/main.py: -------------------------------------------------------------------------------- 1 | print("Namaste Bharat") 2 | -------------------------------------------------------------------------------- /Python/number guesser game.py: -------------------------------------------------------------------------------- 1 | import random #dhruv2003 2 | 3 | top_range=input("enter top range: ") 4 | 5 | if top_range.isdigit(): 6 | top_range=int(top_range) 7 | 8 | if top_range <= 0: 9 | print("please type no larger than 0") 10 | quit() 11 | else: 12 | print("type a number next time !") 13 | quit() 14 | 15 | random_number=random.randint(0,top_range) 16 | guess=0 17 | 18 | while True: 19 | guess += 1 20 | user_guess=input("Make a guess: ") 21 | if user_guess.isdigit(): 22 | user_guess = int(user_guess) 23 | else: 24 | print("Please type a number!") 25 | continue 26 | 27 | if user_guess == random_number: 28 | print("YOU GOT IT!") 29 | break 30 | elif user_guess > random_number: 31 | print("You were above the number!") 32 | else: 33 | print("you were below the number!!!") 34 | 35 | print("You got it in",guess,"guesses") -------------------------------------------------------------------------------- /Python/print 1 to 100 without numbers.py: -------------------------------------------------------------------------------- 1 | # AdrshCode 2 | 3 | for i in range(1, ord("e")): 4 | print(i) 5 | 6 | 7 | -------------------------------------------------------------------------------- /Python/snakegame.py: -------------------------------------------------------------------------------- 1 | from random import randrange 2 | from freegames import square,vector 3 | 4 | food=vector(0,0) 5 | snake=[vector(10,0)] 6 | aim=vector(0,-10) 7 | 8 | def change(x,y): 9 | aim.x=x 10 | aim.y=y 11 | 12 | def inside(head): 13 | return -200 < head.x < 190 and -200 < head.y < 190 14 | 15 | def move(): 16 | head=snake[-1].copy() 17 | head.move(aim) 18 | if not inside(head) or head in snake: 19 | square(head.x,head.y,9,"red") 20 | update() 21 | return 22 | snake.append() 23 | 24 | if head==food: 25 | print("snake",len(snake)) 26 | food.x=randrange(-15,15)*10 27 | food.y=randrange(-15,15)*10 28 | else: 29 | snake.pop(0) 30 | clear() 31 | 32 | for body in snake: 33 | square(body.x,body.y,9,"green") 34 | 35 | square(food.x,food,y,9,"red") 36 | update() 37 | ontimer(move,100) 38 | 39 | hideturtle() 40 | tracer(false) 41 | listen() 42 | onkey(lambda:changes(10,0),"Right") 43 | onkey(lambda:changes(-10,0),"Left") 44 | onkey(lambda:changes(0,10),"Up") 45 | onkey(lambda:changes(0,-10),"Down") 46 | 47 | move() 48 | done() 49 | -------------------------------------------------------------------------------- /Python/starpattern.py: -------------------------------------------------------------------------------- 1 | """ 2 | star pattern : It takes input from the user and produces the star pattern accordingly as given below.. 3 | 4 | for eg :-- 5 | Inout: 6 | 7 | Enter the value of n: 5 8 | Output: 9 | * 10 | * * 11 | * * * 12 | * * * * 13 | * * * * * 14 | * * * * 15 | * * * 16 | * * 17 | * 18 | 19 | Enter the value of n: 8 20 | Output: 21 | * 22 | * * 23 | * * * 24 | * * * * 25 | * * * * * 26 | * * * * * * 27 | * * * * * * * 28 | * * * * * * * * 29 | * * * * * * * 30 | * * * * * * 31 | * * * * * 32 | * * * * 33 | * * * 34 | * * 35 | * 36 | 37 | 38 | 39 | 40 | 41 | """ 42 | 43 | n = int(input("Enter the value of n: ")) 44 | for i in range(n): 45 | for j in range(0 , i+1): 46 | print("* " , end = "") 47 | print() 48 | for i in range(n-1,0,-1): 49 | for j in range(0 , i): 50 | print("* " , end = "") 51 | print() 52 | 53 | print("______________Program Over_______________") 54 | -------------------------------------------------------------------------------- /Python/tic_tac_toe_game.py: -------------------------------------------------------------------------------- 1 | """ 2 | Program : A tic tac toe game written in Python which can be played between 2 players 3 | Github Username : @AshishKingdom 4 | """ 5 | 6 | class TicTacToe: 7 | """ 8 | init some variables required for this class 9 | """ 10 | def __init__ (self): 11 | self.board = [['1','2','3'],['4','5','6'],['7','8','9']] 12 | self.player1 = "X" 13 | self.player2 = "O" 14 | self.game_over = False 15 | return 16 | 17 | """ 18 | draws the current board data in a good format 19 | """ 20 | def draw_board(self): 21 | p = 0 22 | print("\n\n") 23 | for i in self.board: 24 | print(f" {i[0]} | {i[1]} | {i[2]} ") 25 | if p<2: 26 | print("-------------") 27 | p = p + 1 28 | print() 29 | return 30 | 31 | 32 | def set_value(self, position, t): 33 | for b in self.board: 34 | for i in range(0,3): 35 | if b[i]==position: 36 | b[i] = t 37 | return True 38 | 39 | # if player enters wrong position 40 | print("Invalid Input! Please enter value between 1-9 only!") 41 | print("Enter your move again (1-9) : ") 42 | return False 43 | 44 | """ 45 | plays the current game until the game gets tie or a player wins 46 | """ 47 | def play(self): 48 | current_chance = 1 # 1-> player1 chance, -1 -> player 2 chance 49 | while self.game_status()==0: 50 | self.draw_board() 51 | if current_chance==1: 52 | cp = "X" 53 | print("Player 1, Enter your move (1-9) : ") 54 | else: 55 | cp = "O" 56 | print("Player 2, Enter your move (1-9) : ") 57 | while not self.set_value(input(), cp): 58 | pass 59 | current_chance = current_chance * -1 # switch between 1 and -1 60 | 61 | self.draw_board() 62 | s = self.game_status() 63 | if s==1: 64 | print("Player 1 Wins!!!") 65 | elif s==2: 66 | print("Player 2 Winns!!!") 67 | else: 68 | print("It's a TIE!!!") 69 | 70 | 71 | """ 72 | returns 1 if player1 has won, 2 if player2 has won, 3 if the game has tie 73 | 0 if the game is still in progress 74 | """ 75 | def game_status(self): 76 | 77 | b = self.board 78 | for i in range(0,3): #row case 79 | if b[i][0]=='X' and b[i][1]=='X' and b[i][2]=='X': 80 | return 1 81 | if b[i][0]=='O' and b[i][1]=='O' and b[i][2]=='O': 82 | return 2 83 | 84 | for i in range(0,3): #column case 85 | if b[0][i]=='X' and b[1][i]=='X' and b[2][i]=='X': 86 | return 1 87 | if b[0][i]=='O' and b[1][i]=='O' and b[2][i]=='O': 88 | return 2 89 | #diagonal case 90 | if (b[0][0]=='X' and b[1][1]=='X' and b[2][2]=='X') or (b[0][2]=='X' and b[1][1]=='X' and b[2][0]=='X'): 91 | return 1 92 | if (b[0][0]=='O' and b[1][1]=='O' and b[2][2]=='O') or (b[0][2]=='O' and b[1][1]=='O' and b[2][0]=='O'): 93 | return 2 94 | #checking if their is a tie 95 | for i in range(0,3): 96 | for d in "123456789": 97 | if d in b[i]: 98 | return 0 #one more chance is left 99 | return 3 # its a tie! 100 | 101 | 102 | if __name__ == "__main__": 103 | game = TicTacToe() 104 | game.play() -------------------------------------------------------------------------------- /Python/webp to png.py: -------------------------------------------------------------------------------- 1 | from PIL import Image 2 | import os 3 | 4 | path = PATH HERE 5 | a = os.listdir(path) 6 | for i in a: 7 | im = Image.open(path + '/' + i ).convert("RGB") 8 | name = i.split('.')[0] 9 | im.save(path + '/' + f'{name}.jpg', 'jpeg') 10 | os.remove(path + '/' + i ) 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Python/words.py: -------------------------------------------------------------------------------- 1 | word_list=[ #words for hangman #dhruv2003 2 | 'wares', 3 | 'soup', 4 | 'mount', 5 | 'extend', 6 | 'brown', 7 | 'expert', 8 | 'tired', 9 | 'humidity', 10 | 'backpack', 11 | 'crust', 12 | 'dent', 13 | 'market', 14 | 'knock', 15 | 'smite', 16 | 'windy', 17 | 'coin', 18 | 'throw', 19 | 'silence', 20 | 'bluff', 21 | 'downfall', 22 | 'climb', 23 | 'lying', 24 | 'weaver', 25 | 'snob', 26 | 'kickoff', 27 | 'match', 28 | 'quaker', 29 | 'foreman', 30 | 'excite', 31 | 'thinking', 32 | 'mend', 33 | 'allergen', 34 | 'pruning', 35 | 'coat', 36 | 'emerald', 37 | 'coherent', 38 | 'manic', 39 | 'multiple', 40 | 'square', 41 | 'funded', 42 | 'funnel', 43 | 'sailing', 44 | 'dream', 45 | 'mutation', 46 | 'strict', 47 | 'mystic', 48 | 'film', 49 | 'guide', 50 | 'strain', 51 | 'bishop', 52 | 'settle', 53 | 'plateau', 54 | 'emigrate', 55 | 'marching', 56 | 'optimal', 57 | 'medley', 58 | 'endanger', 59 | 'wick', 60 | 'condone', 61 | 'schema', 62 | 'rage', 63 | 'figure', 64 | 'plague', 65 | 'aloof', 66 | 'there', 67 | 'reusable', 68 | 'refinery', 69 | 'suffer', 70 | 'affirm', 71 | 'captive', 72 | 'flipping', 73 | 'prolong', 74 | 'main', 75 | 'coral', 76 | 'dinner', 77 | 'rabbit', 78 | 'chill', 79 | 'seed', 80 | 'born', 81 | 'shampoo', 82 | 'italian', 83 | 'giggle', 84 | 'roost', 85 | 'palm', 86 | 'globe', 87 | 'wise', 88 | 'grandson', 89 | 'running', 90 | 'sunlight', 91 | 'spending', 92 | 'crunch', 93 | 'tangle', 94 | 'forego', 95 | 'tailor', 96 | 'divinity', 97 | 'probe', 98 | 'bearded', 99 | 'premium', 100 | 'featured', 101 | 'serve', 102 | 'borrower', 103 | 'examine', 104 | 'legal', 105 | 'outlive', 106 | 'unnamed', 107 | 'unending', 108 | 'snow', 109 | 'whisper', 110 | 'bundle', 111 | 'bracket', 112 | 'deny', 113 | 'blurred', 114 | 'pentagon', 115 | 'reformed', 116 | 'polarity', 117 | 'jumping', 118 | 'gain', 119 | 'laundry', 120 | 'hobble', 121 | 'culture', 122 | 'whittle', 123 | 'docket', 124 | 'mayhem', 125 | 'build', 126 | 'peel', 127 | 'board', 128 | 'keen', 129 | 'glorious', 130 | 'singular', 131 | 'cavalry', 132 | 'present', 133 | 'cold', 134 | 'hook', 135 | 'salted', 136 | 'just', 137 | 'dumpling', 138 | 'glimmer', 139 | 'drowning', 140 | 'admiral', 141 | 'sketch', 142 | 'subject', 143 | 'upright', 144 | 'sunshine', 145 | 'slide', 146 | 'calamity', 147 | 'gurney', 148 | 'adult', 149 | 'adore', 150 | 'weld', 151 | 'masking', 152 | 'print', 153 | 'wishful', 154 | 'foyer', 155 | 'tofu', 156 | 'machete', 157 | 'diced', 158 | 'behemoth', 159 | 'rout', 160 | 'midwife', 161 | 'neglect', 162 | 'mass', 163 | 'game', 164 | 'stocking', 165 | 'folly', 166 | 'action', 167 | 'bubbling', 168 | 'scented', 169 | 'sprinter', 170 | 'bingo', 171 | 'egyptian', 172 | 'comedy', 173 | 'rung', 174 | 'outdated', 175 | 'radical', 176 | 'escalate', 177 | 'mutter', 178 | 'desert', 179 | 'memento', 180 | 'kayak', 181 | 'talon', 182 | 'portion', 183 | 'affirm', 184 | 'dashing', 185 | 'fare', 186 | 'battle', 187 | 'pupil', 188 | 'rite', 189 | 'smash', 190 | 'true', 191 | 'entrance', 192 | 'counting', 193 | 'peruse', 194 | 'dioxide', 195 | 'hermit', 196 | 'carving', 197 | 'backyard', 198 | 'homeless', 199 | 'medley', 200 | 'packet', 201 | 'tickle', 202 | 'coming', 203 | 'leave', 204 | 'swing', 205 | 'thicket', 206 | 'reserve', 207 | 'murder', 208 | 'costly', 209 | 'corduroy', 210 | 'bump', 211 | 'oncology', 212 | 'swatch', 213 | 'rundown', 214 | 'steal', 215 | 'teller', 216 | 'cable', 217 | 'oily', 218 | 'official', 219 | 'abyss', 220 | 'schism', 221 | 'failing', 222 | 'guru', 223 | 'trim', 224 | 'alfalfa', 225 | 'doubt', 226 | 'booming', 227 | 'bruised', 228 | 'playful', 229 | 'kicker', 230 | 'jockey', 231 | 'handmade', 232 | 'landfall', 233 | 'rhythm', 234 | 'keep', 235 | 'reassure', 236 | 'garland', 237 | 'sauna', 238 | 'idiom', 239 | 'fluent', 240 | 'lope', 241 | 'gland', 242 | 'amend', 243 | 'fashion', 244 | 'treaty', 245 | 'standing', 246 | 'current', 247 | 'sharpen', 248 | 'cinder', 249 | 'idealist', 250 | 'festive', 251 | 'frame', 252 | 'molten', 253 | 'sill', 254 | 'glisten', 255 | 'fearful', 256 | 'basement', 257 | 'minutia', 258 | 'coin', 259 | 'stick', 260 | 'featured', 261 | 'soot', 262 | 'static', 263 | 'crazed', 264 | 'upset', 265 | 'robotics', 266 | 'dwarf', 267 | 'shield', 268 | 'butler', 269 | 'stitch', 270 | 'stub', 271 | 'sabotage', 272 | 'parlor', 273 | 'prompt', 274 | 'heady', 275 | 'horn', 276 | 'bygone', 277 | 'rework', 278 | 'painful', 279 | 'composer', 280 | 'glance', 281 | 'acquit', 282 | 'eagle', 283 | 'solvent', 284 | 'backbone', 285 | 'smart', 286 | 'atlas', 287 | 'leap', 288 | 'danger', 289 | 'bruise', 290 | 'seminar', 291 | 'tinge', 292 | 'trip', 293 | 'narrow', 294 | 'while', 295 | 'jaguar', 296 | 'seminary', 297 | 'command', 298 | 'cassette', 299 | 'draw', 300 | 'anchovy', 301 | 'scream', 302 | 'blush', 303 | 'organic', 304 | 'applause', 305 | 'parallel', 306 | 'trolley', 307 | 'pathos', 308 | 'origin', 309 | 'hang', 310 | 'pungent', 311 | 'angular', 312 | 'stubble', 313 | 'painted', 314 | 'forward', 315 | 'saddle', 316 | 'muddy', 317 | 'orchid', 318 | 'prudence', 319 | 'disprove', 320 | 'yiddish', 321 | 'lobbying', 322 | 'neuron', 323 | 'tumor', 324 | 'haitian', 325 | 'swift', 326 | 'mantel', 327 | 'wardrobe', 328 | 'consist', 329 | 'storied', 330 | 'extreme', 331 | 'payback', 332 | 'control', 333 | 'dummy', 334 | 'influx', 335 | 'realtor', 336 | 'detach', 337 | 'flake', 338 | 'consign', 339 | 'adjunct', 340 | 'stylized', 341 | 'weep', 342 | 'prepare', 343 | 'pioneer', 344 | 'tail', 345 | 'platoon', 346 | 'exercise', 347 | 'dummy', 348 | 'clap', 349 | 'actor', 350 | 'spark', 351 | 'dope', 352 | 'phrase', 353 | 'welsh', 354 | 'wall', 355 | 'whine', 356 | 'fickle', 357 | 'wrong', 358 | 'stamina', 359 | 'dazed', 360 | 'cramp', 361 | 'filet', 362 | 'foresee', 363 | 'seller', 364 | 'award', 365 | 'mare', 366 | 'uncover', 367 | 'drowning', 368 | 'ease', 369 | 'buttery', 370 | 'luxury', 371 | 'bigotry', 372 | 'muddy', 373 | 'photon', 374 | 'snow', 375 | 'oppress', 376 | 'blessed', 377 | 'call', 378 | 'stain', 379 | 'amber', 380 | 'rental', 381 | 'nominee', 382 | 'township', 383 | 'adhesive', 384 | 'lengthy', 385 | 'swarm', 386 | 'court', 387 | 'baguette', 388 | 'leper', 389 | 'vital', 390 | 'push', 391 | 'digger', 392 | 'setback', 393 | 'accused', 394 | 'taker', 395 | 'genie', 396 | 'reverse', 397 | 'fake', 398 | 'widowed', 399 | 'renewed', 400 | 'goodness', 401 | 'featured', 402 | 'curse', 403 | 'shocked', 404 | 'shove', 405 | 'marked', 406 | 'interact', 407 | 'mane', 408 | 'hawk', 409 | 'kidnap', 410 | 'noble', 411 | 'proton', 412 | 'effort', 413 | 'patriot', 414 | 'showcase', 415 | 'parish', 416 | 'mosaic', 417 | 'coil', 418 | 'aide', 419 | 'breeder', 420 | 'concoct', 421 | 'pathway', 422 | 'hearing', 423 | 'bayou', 424 | 'regimen', 425 | 'drain', 426 | 'bereft', 427 | 'matte', 428 | 'bill', 429 | 'medal', 430 | 'prickly', 431 | 'sarcasm', 432 | 'stuffy', 433 | 'allege', 434 | 'monopoly', 435 | 'lighter', 436 | 'repair', 437 | 'worship', 438 | 'vent', 439 | 'hybrid', 440 | 'buffet', 441 | 'lively'] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Kindly Don't Contribute in This Repo because your Repo will not be counted in Hacktoberfest! 3 | 4 | # ✨#Hacktoberfest 2022✨ 5 | A Simple😉 beginner friendly😊 Repo for all programmers and coders. All contributors are requested to star🌟this repo and and folllllow me. 6 | 7 | Contribute to start your journey with hacktoberfest and python. Happy Hacking💻!!! (*Required) 8 | 9 | # 🌟Languages 10 | - 💻 C 11 | - 💻 C++ 12 | - 💻 PHP 13 | - 💻 Python 14 | - 💻 Java 15 | - 💻 Javascript 16 | 17 | # 🛡Rules to Contribute 18 | - ⚓Star this repo to get latest updates. 19 | - ⚓Give your file a proper extension according to language. Ex. .py, .java, .js. html etc. 20 | - ⚓Name your file related to your topic. 21 | - ⚓Put your files in correct folder like .py in Python, .js in Javascript etc. 22 | - ⚓Make sure you have entered your github - username, aim and date in your file as a comment. 23 | - ⚓Make sure you have entered your name in CONTRIBUTORS.md file as mentioned (It's your responsibility) (optional). 24 | - ⚓You can follow ME😁. 25 | 26 | # ❄Format of 5th line in rules 27 |
// Github username: Your Username
28 | // Aim: Your Repo aim according to your program
29 | // Date: Date of Coding
30 | 
31 | // start coding
32 | 
33 | 
34 | 35 | ### ⚡If your program have class try to use your class with its objects 36 | 37 | ### ⚡If you are creating any PR then Add your name in CONTRIBUTORS.md file 38 | 39 | ## 🛡Follow rules strictly for successful merged PR!!! 40 | 41 | # ❄Prgrams 42 | - ⚡Create any pattern 43 | - ⚡Make any algorithm (exclude calculator or related to it) 44 | - ⚡Print 1 to 100 without using numbers 45 | - ⚡Make calculator without using operators in program 46 | - ⚡Calculate fibonacci series with classes 47 | - ⚡Calculate factorial with classes 48 | - ⚡Print IP Address and Hostname 49 | 50 | 51 | ## Don't forget to read the contributing rules above to be successfully merged your PR and get rewards!!! 52 | 53 | 🏹 Visit Hacktoberfest to get more information about Hacktoberfest 2022!!! 54 | 55 | ✈ Visit Hacktoberfest-swag to know more about your swags and rewards!!! 56 | 57 | # 🛡 Strictly follow rules to contribute for successful merged PR!!! 58 | 59 | # Note 60 | All contributors who have followed the rules to contribute get successfully merged PR. Don't forget to follow!!! 61 | 62 | Have some patience to get successfully merged PR. Keep Patience!!! 63 | 64 | # HAPPY HACKING🤞❤💻!!! 65 | --------------------------------------------------------------------------------