Translate the following C program into NASM.
#include int main(){ int x = 0; char sent[20]; printf("Enter sentence: "); scanf("%[^\n]s", sent); while (sent [x] != '\0') { if (sent[x] >= 'a' && sent[x] <= 'z')="">=> sent[x] = sent[x] & 0xDF; } x++; } printf("%s \n", sent);}Use indexing (the [ebx] form). You can use the following pseudocode in the “bss” to allocate the array: slen equ 20 sent resb slenNote: the scanf format string of “%[^\n]s” keeps reading characters until the newline (otherwise it would end at the first space).
int main()
{
int x = 0;
char sent[20];
printf("Enter sentence: ");
scanf("%[^\n]s", sent);
while (sent [x] != '\0') {
if (sent[x] >= 'a' && sent[x] <= 'z')="">=>
sent[x] = sent[x] & 0xDF;
}
x++;
printf("%s \n", sent);
Use indexing (the [ebx] form). You can use the following pseudocode in the “bss” to allocate the array:
slen equ 20
sent resb slen
Note: the scanf format string of “%[^\n]s” keeps reading characters until the newline (otherwise it would end at the first space).
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here