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
;Hello World Program | |
section .data | |
msg db "Hello, World! From Assembly.", 0xA ; newline-terminated string | |
len equ $-msg ; length of the string | |
section .text | |
global _start | |
_start: | |
mov rax, 1 ; syscall for write. |
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
//Preprocessing Directives | |
#include<stdio.h> //For printf(). | |
//Function Prototypes | |
void Char_Cycler(const char *str); | |
void delay(void); | |
//Function Definition | |
void Char_Cycler(const char *str) | |
{ |
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
//Preprocessing Directives | |
#include<stdio.h> //For printf(). | |
//Function Prototypes | |
int my_strcmp(const char *str1, const char *str2); | |
void my_strcat(char *dest, const char *src); | |
void my_strcpy(char *dest, const char *src); | |
int my_strlen(const char *str); | |
//Function Definitions |
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
// Preprocessing Directives | |
#include<stdio.h> // For printf(). | |
#include<string.h> //For strlen(). | |
//Number Swapping | |
//Swaps any two numbers in a single-line using function-like macros. | |
#define SWAP(x, y) do{int temp=x; x=y; y=temp;}while(0) // The do-while(0) runs a single time. | |
int main() | |
{ | |
int a=5, b=6, no=120, s=0, i, n=10, f0=0, f1=1, f; |
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
//Dependencies | |
#include<stdio.h> // For printf(), scanf(), etc,. | |
//Function Prototypes | |
int NumForge(int arr[], int size, int DigitSize); | |
// NumForge | |
// Takes an array of numbers, size of the array, size of the number to be created. | |
// Promts the user for largest/smallest number. | |
// Sorts out the array using bubble sort. |
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
// Dependencies | |
#include<stdio.h> // For printf(), scanf(), etc,. | |
//Function Prototypes | |
int Binary_Search(int arr[], int size, int s); | |
// Binary Search | |
// Searches for an element in an array sorteed in ascending order. | |
// If the Search element is equal to middle element of the array, the search is complete. | |
// If the Search element is less than the middle element of the array, the search continues on the left sub-array. |
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
// Dependencies | |
#include<stdio.h> // For printf(), scanf(), etc,. | |
//Function Prototypes | |
int Linear_Search(int arr[], int s, int size); | |
// Linear Search | |
// Searches the element 's' in the array 'arr' of size 'size'. | |
// Prints the index of the element if found. | |
int Linear_Search(int arr[], int s, int size) |
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
//Function Prototypes | |
int Collatz_Conjecture(int n); | |
//Collatz Conjecture | |
int Collatz_Conjecture(int n) | |
{ | |
while(n!=1) | |
{ | |
// If Even Number | |
if(n%2==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
// Function Prototypes | |
int GCD(int a, int b); | |
// Greatest Common Divisor | |
int GCD(int a, int b) | |
{ | |
int i, c, d, temp; | |
if(b==0) | |
{ | |
printf("GCD of %d and %d is %d", a, b, a); |
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
// Function Prototypes | |
int LCM(int a, int b); | |
int GCD(int a, int b); | |
// Least Common Multiple | |
int LCM(int a, int b) | |
{ | |
int LCM; | |
LCM=(a*b)/(GCD(a, b)); | |
printf("\nLCM of %d and %d is %d", a, b, LCM); |
NewerOlder