A program t outputs three triangles of asterisks in C with the help of function and then translate into assembly language in Pep/9.
Available answer on chegg is not giving output on Pep/9.
; program inputs m then prints a triangle of stars with
; m rows of stars. The first row has m stars, the second
; has m-1 stars, the third has m-2 stars and so on.
;
stro prompt,d
deci numrows,d ; number of rows to print
top: ldwa numrows,d
stwa numonrow,d ; inner loop limit is same as rows left
top2: ldba '*',i
stba charOut,d
ldwa numonrow,d
suba 1,i
stwa numonrow,d ; number of stars left to print on line
brne top2 ; branch if more to print on this line
ldba '\n',i
stba charOut,d ; no more so output newline character
ldwa numrows,d
suba 1,i
stwa numrows,d ; number of rows to print is decreased
brne top ; branch if more rows to print
stop
numonrow: .block 2 ; inner loop counter
numrows: .block 2 ; number of rows still to print
prompt: .ascii “Enter number of rows\x00”
.end
A program t outputs three triangles of asterisks in C with the help of function and...
C program
1. Write a function which draws a line of n asterisks, n being passed as a parameter to the function. Write a driver program (a program that calls and tests the function) which uses the function to output an m x n block of asterisks, m and n entered by the user.
Translate the following C program to Pep/9 assembly language. #include <stdio.h> int main() { int number; scanf("%d", &number); if (number % 2 == 0) { printf("Even\n"); } else { printf("Odd\n"); } return 0; }
Translate the following C program to Pep/9 assembly language. #include <stdio.h> const int limit = 5; int main() { int number; scanf("%d",&number); while (number < limit){ number++; printf("%d",number); } return 0; }
Hello guys ! Could you let me know about this ?? Translate the following C program to Pep/9 assembly language. #include <stdio.h> int main() { int number; scanf("%d", &number); if (number % 2 == 0) { printf("Even\n") } else { printf("Odd\n"); } return 0; } Thank you !
Write a Pep/9 assembly code program that inputs integer N then outputs an N-row triangle in which the rows have a decreasing and odd number of stars. The last row has one star above which the other rows are centered. For example, if N is 5 the output should be ********* ******* ***** *** *
C++ Can somebody help me with this 2 integer right triangles There are right-angled triangles (i.e., triangles, for which the theorem of Pythagoras applies), whose side lengths are all integers are. Write a program that finds all these triangles in the form of the lengths of their three sides and these three Output page lengths for each triangle found. This should only page lengths not greater than 500 are taken into account. In addition, specify the number of...
C code. Write a program to find all the triangles with integer side lengths and a user specified perimeter. Perimeter is the sum of all the sides of the triangle. Integers a, b and c form a triangle if the sum of the lengths of any two sides is greater than the third side. Your program should find all the triples a, b and c where a + b + c is user specified perimeter value. Print each triple only...
Language: ARM assembly Need help writing a program that takes user input as a string and outputs the string with all the vowels replaced with "x". For example, the string "Robot" should output ""Rxbxt"
C++: Write a program that gets three words from the input, and then outputs the longest word. If the input is: Hello Microwave Bat The output is: Microwave
Translate the following C program to Pep/9 assembly language. It multiplies two integers using a recursive shift-and-add algorithm. mpr stands for multiplier and mcand stands for multiplicand. A recursive integer multiplication algorithm #include <stdio.h> int times(int mpr, int mcand) { if (mpr == 0) { return 0; } else if (mpr % 2 == 1) { return times(mpr / 2, mcand * 2) + mcand; } else { return times(mpr / 2, mcand * 2); } } int main() { ...