This file contains 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
;program that divide 6 by 3 | |
.model small | |
.stack 200h | |
.code | |
Start: | |
mov ax,6 ;preparing the dividend | |
mov dx,0 ;zero extension | |
mov cx,3 ;preparing the divisor | |
div cx ;divides AX by CX, with quotient being stored in AX, and remainder in DX | |
mov ah, 4ch ;preparing exit call |
This file contains 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
#include <stdio.h> | |
int main(){ | |
int i=0; // | |
while (i<=127){ /*227 = total number of asii value*/ | |
if (i%8==0 ) { | |
printf("\n"); | |
} | |
if ((i<=32) || (i==127) ){ /*Since 1-32 and 127 is non-printable*/ | |
printf("%c",'.'); /*replace non-printable character with .*/ |
This file contains 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
#include <stdio.h> | |
#define LOWER_BOUND 33 //since 1-33 is considered nonprintable prof said consider space and tab as nonprintable | |
#define UPPER_BOUND 127 | |
int main() { | |
char row[9]; //8 characters a row | |
int c, d; //d is used to control the bounds of the row buffer | |
for (d = 0, c = 0; c <= UPPER_BOUND; c++) { // c is the used as the ascii | |
if (c < LOWER_BOUND || c >= UPPER_BOUND) //1-33 or 127 print . |
This file contains 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
; The formula that I am trying to implement is (a+b-c)*d/e | |
; Caution: will not work with negative and floating point numbers | |
BITS 32 ;declare it as a 32 bit code | |
GLOBAL _start | |
SECTION .text | |
_start: | |
mov ebx,4 ;variable a | |
mov eax,4 ;variable b | |
mov ecx,5 ;variable c | |
mov edx,2 ;variable d |
This file contains 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
/*Calculating compound interest*/ | |
#include <stdio.h> | |
#include <math.h> | |
int main (void) { | |
double amount; | |
double principal; | |
double rate; | |
int year; | |
int i; |
This file contains 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
allFiles: fraction.c | |
gcc -Wall fraction.c -o fraction.out -lm | |
clean: | |
rm *.o fraction.out |
This file contains 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
allFiles: fraction.c | |
gcc -Wall fraction.c -o fraction.out -lm | |
clean: | |
rm *.o fraction.out |
This file contains 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
#include <stdio.h> | |
#include <math.h> | |
#include <stdlib.h> | |
/*Declaring Constant */ | |
int const BASE = 2; | |
int const BASE_TEN = 10; | |
/* converting from decimal require the following information input number,quotient, remainder*/ | |
int inputNumber; | |
int calculationRemainder; |
This file contains 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
allFiles: draw.c | |
gcc -Wall draw.c -o draw.out -lm | |
clean: | |
rm *.o draw.out |
This file contains 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
/*Calculate the diameter,circumference and area of a circle | |
Using C pi*/ | |
/*Including Library*/ | |
#include <math.h> | |
#include <stdio.h> | |
int main (void) { | |
/*Declaring the variable*/ | |
int radius; |