VB:编程题~~在文本框1中输入一个整数n,判断其能否同时被5和7整除……

在文本框1中输入一个整数n,判断其能否同时被5和7整除,如能则使用标签输出“XXX能同时被5和7整除”,否则输出“XXX不能同时被5和7整除”。要求:标签中的XXX为输入... 在文本框1中输入一个整数n,判断其能否同时被5和7整除,如能则使用标签输出“XXX能同时被5和7 整除”,否则输出“XXX不能同时被5和7 整除”。
要求:标签中的XXX为输入的具体数据,如35、178、70等。
【本题要求上传窗体文件】
展开
 我来答
mafan8
推荐于2017-09-21 · TA获得超过1.7万个赞
知道小有建树答主
回答量:927
采纳率:0%
帮助的人:754万
展开全部
你新建一个窗体,上面text、label、command控件各一个
Private Sub Command1_Click()
If Not IsNumeric(Text1.Text) Then Exit Sub
If Val(Text1.Text) Mod 5 = 0 And Val(Text1.Text) Mod 7 = 0 Then
Label1.Caption = Text1.Text & "能同时被5和7 整除"
Else
Label1.Caption = Text1.Text & "不能同时被5和7 整除"
End If
End Sub
猫建薄g
2019-10-09
知道答主
回答量:18
采纳率:50%
帮助的人:5.9万
展开全部
Console.Writeline("请输入一个整数:");
int n;
n=int.Parse(Console.ReadLine());
if(n%5==0&&n%7==0)

Console.WriteLine(n+"能够同时被5和7整除");
Console.Read();

elsew

Console.WriteLine(n+"不能够同时被5和7整除");
Console.Read();
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
喻元恺Va
2010-04-21 · TA获得超过904个赞
知道小有建树答主
回答量:4465
采纳率:0%
帮助的人:1773万
展开全部
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form

'Form 重写 Dispose,以清理组件列表。
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub

'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer

'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改它。
'不要使用代码编辑器修改它。
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(26, 82)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 0
Me.Button1.Tag = ""
Me.Button1.Text = "开始判读"
Me.Button1.UseVisualStyleBackColor = True
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(115, 28)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(159, 21)
Me.TextBox1.TabIndex = 2
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(129, 87)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(65, 12)
Me.Label2.TabIndex = 3
Me.Label2.Text = "判读结果:"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(12, 31)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(89, 12)
Me.Label1.TabIndex = 3
Me.Label1.Text = "请输入一个数字"
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(360, 138)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label

End Class

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
If Me.TextBox1.Text.Trim() <> String.Empty Then

i = CInt(Me.TextBox1.Text.Trim())
If i Mod 5 = 0 And i Mod 7 = 0 Then
Me.Label2.Text = "判读结果:" + i.ToString() + "能够被 5 和 7 同时整除"
Else
Me.Label2.Text = "判读结果:" + i.ToString() + "不能够被 5 和 7 同时整除"
End If
End If
End Sub
End Class
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
296224229
2010-04-21 · TA获得超过273个赞
知道小有建树答主
回答量:214
采纳率:0%
帮助的人:0
展开全部
在窗体添加一个文本框和一个标签和一个按钮

Private Sub Command1_Click()
If Val(Text1.Text) Mod 5 = 0 And Val(Text1.Text) Mod 7 = 0 Then
Label1.Caption = Text1.Text & "能同时被5和7整除"
Else
Label1.Caption = Text1.Text & "不能同时被5和7整除"
End If
End Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(2)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式