I posted this before, and it was answered incorrectly. THIS NEEDS TO BE IN PEP8
ID: 3798543 • Letter: I
Question
I posted this before, and it was answered incorrectly.
THIS NEEDS TO BE IN PEP8 / PEP9 ASSEMBLY. DO NOT USE INTEL X86
Convert the following C code to Pep8 or Pep9 assembly.
#include <stdio.h>
#include <math.h>
int n = 0;
int main()
{
printf("N: ");
scanf("%d", &n);
if (n <= 0) {
printf("Goodbye");
return 0;
}
int r = n - (n * 0.125);
int boxes = r / 16;
int individual = r % 16;
if (individual > 0) {
int total = (boxes * 8) + ((individual + 1) * 2);
printf("Cost to ship is $%d", total);
}
else {
int total = (boxes * 8) + (individual * 2);
printf("Cost to ship is $%d", total);
}
return 0;
}
Explanation / Answer
Answer:-