Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1064861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T19:43:45+00:00 2026-05-16T19:43:45+00:00

I have the following assembly code (written for NASM on Linux): ; This code

  • 0

I have the following assembly code (written for NASM on Linux):

; This code has been generated by the 7Basic
; compiler <http://launchpad.net/7basic>

extern printf
extern scanf

      SECTION .data
printf_f: db "%f",10,0
scanf_f: db "%f",0

      SECTION .bss
v_0 resb 8

      SECTION .text

global main
  main:
push ebp
mov ebp,esp
push v_0         ; load the address of the variable
push scanf_f     ; push the format string
call scanf       ; call scanf()
add esp,8
push dword [v_0+4]  ; load the upper-half of the double
push dword [v_0]    ; load the bottom-half
push printf_f     ; push the format string
call printf       ; call printf
add esp,12
mov esp,ebp
pop ebp
mov eax,0
ret

When I assemble and run the program, I get a prompt as expected. However, no matter what number I enter, the output is always 0.000000.

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T19:43:45+00:00Added an answer on May 16, 2026 at 7:43 pm

    You are trying to scan a float with the ‘%f’ token but providing a double. Pass in a float variable to scanf and then convert to a double or pass in ‘%lf’ as the format string to scanf.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written the following code, can you explain me what does the assembly
My EAX register contains the xxxxxx9D value and I have the following assembly code:
I have a simple assembly code file called exit.s that looks like the following:
I have the following code: namespace ConectorV2 { [assembly:InternalsVisibleTo(Pruebas)] internal static class Utilidades {
I have the following Powershell code: Add-Type -Assembly System.Configuration [ExeConfigurationFileMap] $configMap = New-Object ExeConfigurationFileMap
So I have the following code segment in x86 assembly: mov $0x0, %eax callq
I have the following assembly code snippet I am trying to understand. It is
I am working through an MVVM tutorial, and I have the following code, written
OK, I have the following bit of code: Assembly assembly = Assembly.LoadFile(W:\\AssemblyFoo.dll); foreach (Type
I were asked to analyze an assembly code, which was generated from following c++

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.