为您找到"
用基本语句写一个算法,要求输入50个数,按从大到小的顺序输出。
"相关结果约100,000,000个
{ int a[51];int i,j,t;printf("please input the numbers:\n");for(i=1;i<=50;i++)scanf("%d",&a[i]);for(i=1;i<50;i++){ for(j=1;j<=50-i;j++)if(a[j]<a[j+1]){t=a[j];a[j]=a[j+1];a[j+1]=t;} } printf("the ordered numbers are as follows\...
type arr=array[1..50] of integer;var a:arr;i,t,p:integer;begin for i:=1 to 50 do readln(a[i]);for p:=1 to 50 do for i:=p to 50 do if a[p]
for i=0 to 49 a(i)=inputbox("请输入第"&i&"个数:")print a(i);next '上面是输入50个数 for i=0 to 49 for j=i+1 to 49 if a(j)
声明一个存放最大值的变量max,再声明一个存放最小值的变量min。输入第一个数字后,把它同时赋给max和min,以后每输入一个数字都和max、min分别比较,把比max大的赋给max,把比min小的赋给min,这样就保证max是所输入的数字中值最大的,而min是输入的数字中值最小的,最后输出max和min即可。代码...
For n = 1 To 900 If n Mod 3 = 0 And n Mod 5 = 1 Then Print n End If Next n 你应该能看明白吧!
echo -e "\nYour Number is: $num.\n" # 将用户输入输出,以便用户确定 echo -e "All the prime from 1 to $num: "for ((n=2; n<=$num; n++)) { is_prime n if [ $flag -eq 1 ]; then echo -n "$n "((sum=sum+n))echo -e "$n Is prime."else echo -e "...
CREATE OR REPLACE PROCEDURE PRO_SortNum(num1 in int ,num2 in int ,num3 in int)AS SELECT num1 NUM FROM dual UNION SELECT num2 NUM FROM dual UNION SELECT num3 NUM FROM dual ORDER BY NUM DESC;END PRO_SortNum;测试语句 declare num1 int declare num2 int declare num3 int ...
cout<<"请输入四个数"<<endl;cin>>x>>y>>z>>p;if(x<y){t=x;x=y;y=t;} if(x<z){t=x;x=z;z=t;} if(x<p){t=x;x=p;p=t;} if(y<z){t=y;y=z;z=t;} if(y<p){t=y;y=p;p=t;} if(z<p){t=z;z=p;p=t;} cout<<x<<y<<z<<p<<endl;这样应该...
Text1 = Text1 & vbCrLf & "最大:" & da & vbCrLf & "最小:" & xiao & vbCrLf & "平均:" & s / n End Sub Private Sub Form_Load()Label1 = "输入随机数个数:"Text2 = 0 Text1 = ""Command1.Caption = "生成随机数"End Sub 不用数组的话直接在第一个for里让text1= ...