网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
06月29日漏签0天
汇编吧 关注:45,337贴子:164,450
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 2回复贴,共1页
<<返回汇编吧
>0< 加载中...

求助请问这个代码该怎么写呀?

  • 只看楼主
  • 收藏

  • 回复
  • 小6bbb6
  • 基础知识
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
用汇编语言编写程序,判断一个已知数值数组中,既能被3整除,又能被5整除的数,并显示输出这些数。
孩子的期末代码一直不会整,愁死我了


  • 54miniz2
  • 流程控制
    6
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
这个容易,起个循环遍历数组,每个数查除以3的余数若为0就再查除以5的余数也为0的话就打印输出就行了


2026-06-29 07:54:50
广告
不感兴趣
开通SVIP免广告
  • 贴吧用户_6S5D6NaMR
  • 基础知识
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
; Fizzbuzz
; Compile with: nasm -f elf 网页链接 ; Link with (64 bit systems require elf_i386 option): ld -m elf_i386 fizzbuzz.o -o fizzbuzz
; Run with: ./fizzbuzz
%include 'functions.asm'
SECTION .data
fizz db 'Fizz', 0h ; a message string
buzz db 'Buzz', 0h ; a message string
SECTION .text
global _start
_start:
mov esi, 0 ; initialise our checkFizz boolean variable
mov edi, 0 ; initialise our checkBuzz boolean variable
mov ecx, 0 ; initialise our counter variable
nextNumber:
inc ecx ; increment our counter variable
.checkFizz:
mov edx, 0 ; clear the edx register - this will hold our remainder after division
mov eax, ecx ; move the value of our counter into eax for division
mov ebx, 3 ; move our number to divide by into ebx (in this case the value is 3)
div ebx ; divide eax by ebx
mov edi, edx ; move our remainder into edi (our checkFizz boolean variable)
cmp edi, 0 ; compare if the remainder is zero (meaning the counter divides by 3)
jne .checkBuzz ; if the remainder is not equal to zero jump to local label checkBuzz
mov eax, fizz ; else move the address of our fizz string into eax for printing
call sprint ; call our string printing function
.checkBuzz:
mov edx, 0 ; clear the edx register - this will hold our remainder after division
mov eax, ecx ; move the value of our counter into eax for division
mov ebx, 5 ; move our number to divide by into ebx (in this case the value is 5)
div ebx ; divide eax by ebx
mov esi, edx ; move our remainder into edi (our checkBuzz boolean variable)
cmp esi, 0 ; compare if the remainder is zero (meaning the counter divides by 5)
jne .checkInt ; if the


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 2回复贴,共1页
<<返回汇编吧
分享到:
©2026 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示