VB 输入一个三位整数,将它反向输出
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/19 22:00:39
PrivateSubForm_Click()Sum=0Fori=100To999s=Trim(Str(i))IfVal(Left(s,1))+Val(Right(s,1))+Val(Mid(s,2,1
创建两个text控件和一个command按钮控件再输入以下代码PrivateSubCommand1_Click()Fori=1ToLen(Text1.Text)a=Mid(Text1.Text,i,1
#includevoidmain(){inta,i=0,b[3];printf("inputathreebitnumber\n");scanf("%d",&a);if(a>=100&&a=0;j--)
#include"stdio.h"intmain(){inta,i,sum=0;printf("请输入3位的整数\n");scanf("%d",&a);for(i=0;i
方法很多嘛随便来一个:#include#includevoidmain(){charp[10];char*q;inti=0;scanf("%s",p);q=p;while(*(q++))i++;q--
main(){intx;scanf("%d",&x);x=(x%10)*100+(x/10%10)*10+(x/100)printf("%d\n",x);}
不是已经有人问过了吗?这里:根据3512174的顺序自己敲一下代码就是了.
PrivateSubCommandButton1_Click()DimnNumAsLongIfIsNumeric(TextBox1.Text)ThennNum=Val(TextBox1.Text)If
#includeintchange(int);voidmain(){intc,d;cout
#includeintmain(void){\x09intnum,i,j,k,sum;\x09printf("输入一个三位整数!\n");\x09scanf("%d",&num);\x09i=num%
PrivateSubForm_Click()DimxAsStringDima%,b%,c%,y%x=InputBox("请输入三位数","提示框")IfLen(x)=3Thena=Val(Mid(x,
999/9=111则较小的三位数最大值为111故满足上述条件的三位数有:1009001019091029181039271049361059451069541079631089721099811109
PrivateSubCommand1_Click()DimaAsInteger,bAsInteger,cAsInteger,dAsIntegera=Val(InputBox("输入三位整数"))b=I
呵呵,一看就知道你刚学.我按照你的思路写的代码,你看看PrivateSubCommand1_Click()a=Val(Text1.Text)IfaText2="负整数"ElseIfa>0ThenTex
intdata=inputdata;if(data>99&&data
ifxmod2=0thenmsgbox"是偶数"elsemsgbox"是奇数"
写成函数,直接调用Functionprint_num(ByValnumAsInteger)Dimi,n,k,jAsIntegerDimstrAsStringn=Int(num/2)k=0IfnumMo
三位数已知?PrivateSubCommand1_Click()DimiAsIntegerFori=100To999IfiMod3=2AndiMod10=1ThenPicture1.Printi;en
Functionisprime(xAsInteger)DimkAsInteger,flagAsBooleank=2flag=TrueWhilek
用Format函数,比如通过text输入,转换后在窗体打印:PrivateSubCommand1_Click()n=Text1.Textt=Format(n,"000.###")PrinttEndSu