This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| num is static -> no need to initialize (=0) | |
| (int)'d' = ascii value of 'd' (=100) | |
| */ | |
| public class Program | |
| { | |
| static int num; | |
| public static void main(String[] args) { | |
| while(num < (int)'d'){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* C Program to Print Negative Numbers in an Array */ | |
| #include<stdio.h> | |
| int main() | |
| { | |
| int Size, i, a[10]; | |
| Size = 10; | |
| printf("\n Please Enter the Array Elements : "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ALGORITHM: | |
| STEP 1: START | |
| STEP 2: INITIALIZE arr[] = {1, 2, 3, 4, 5} | |
| STEP 3: length= sizeof(arr)/sizeof(arr[0]) | |
| STEP 4: PRINT "Original Array:" | |
| STEP 5: REPEAT STEP 6 and STEP 7 UNTIL i<length | |
| STEP 6: PRINT arr[i] | |
| STEP 7: i=i+1 | |
| STEP 8: PRINT new line. | |
| STEP 9: PRINT "Array in reverse order" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \\\ sum of main diagonal | |
| /// sum of sub diagonal | |
| #include <stdio.h> | |
| void main () | |
| { | |
| static int array[10][10]; | |
| int i, j, m, n, a = 0, sum = 0; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Quick sort in Python | |
| # function to find the partition position | |
| def partition(array, low, high): | |
| # choose the rightmost element as pivot | |
| pivot = array[high] | |
| # pointer for greater element | |
| i = low - 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Quick sort in Java | |
| import java.util.Arrays; | |
| class Quicksort { | |
| // method to find the partition position | |
| static int partition(int array[], int low, int high) { | |
| // choose the rightmost element as pivot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Quick sort in C | |
| #include <stdio.h> | |
| // function to swap elements | |
| void swap(int *a, int *b) { | |
| int t = *a; | |
| *a = *b; | |
| *b = t; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let jspdf = document.createElement("script"); | |
| jspdf.onload = function () { | |
| let pdf = new jsPDF(); | |
| let elements = document.getElementsByTagName("img"); | |
| for (let i in elements) { | |
| let img = elements[i]; | |
| console.log("add img ", img); | |
| if (!/^blob:/.test(img.src)) { | |
| console.log("invalid src"); | |
| continue; |
OlderNewer