更多"下列程序中,要求按照从小到大的顺序输出1~100之间所有能被7整除的数"的相关试题:
[简答题]下列程序中,要求按照从小到大的顺序输出1到100之间所有能被7整除的数字,请将下列程序补充完整。
注意:请勿改动main( )主方法和其他已有语句内容,仅在横线处填入适当语句。
public class Example1_3
public static void main(String[] argv)
int i = 1;
________
if(______)
System.out.print(i + ",");
________
while(i < 100);
System.out.println( );
[简答题]下列程序中,要求按照从小到大的顺序输出1~100之间所有能被7整除的数字,请将下列程序补充完整。
注意:请勿改动main( )主方法和其他已有语句内容,仅在横线处填入适当语句。
public class Example1_3
public static void main(String[] argv)
int i = 1;
______
if(______)
System.out.print(i+ ",");
______
while(i < 100);
System.out.println( );
[简答题]下列程序中,要求按照从大到小的顺序输出0~100之间(包括0和100)的能被3整除的所有偶数,并输出符合上述要求的数的个数,请将程序补充完整。程序运行结果如下。
96,90,84,78,72,66,60,54,48,42,36,30,24,18,12,6,0,
源程序文件代码清单如下:
public class ex12_1
private int cnt=0;
public static void main(String args[])
ex12_1 obj12_1=new ex12_1( );
obj12_1.method12_1( );
public void method12_1( )
for (______)
if(______
System.out.print (i+ ", ");
______;
System.out.println( );
System.out.println(cnt);
[单项选择]黑盒测试是将被测试程序看成一个黑盒子,不考虑程序内部结构的情况,而只考虑程序的输入与输出之间的关系,下列属于典型黑盒测试方法的是______。
A. 等价类划分法
B. 静态结构分析法
C. 代码检查法
D. 代码覆盖率分析法
[填空题]
阅读以下说明和C程序,填补空缺。
[说明]
下面的程序按照以下规则输出给定名词的复数形式。
(1)若名词以“y”结尾,则删除y并添加“ies”。
(2)若名词以“s”、“ch”或“sh”结尾,则添加“es”。
(3)其他所有情况,直接添加“s”。
[C程序]
#include<stdio.h>
#include<string.h>
char
*plural(char *word)
{
int n;
char *pstr;
n=strlen(word);
/*求给定单词的长度*/
pstr=(char*)malloc(n+3);
/*申请给定单词的复数形式存储空间*/
if(!pstr || n<2)
return
NULL;
strcpy(pstr, word); /*复制给定单词*/
if( (1) )
{
pstr[n-1]=’i’; pstr[n]=’e’; pstr[n+1]=’s’; (2) ;
}
else
if(pstr[n-1]==’s’||pstr[n-1]==’h’ &&( (3)
))
{
pstr[n]=’e’; pstr[n+1]=’s’;
pstr[n+2]=’/0’;
}
else
{pstr[n]=’s’; pstr[n+1]=’/0’; }
(4) ;
}
main( )
{
int i; char *ps;
char wc[9][10]=
{"chair", "dairy", "boss", "circus", "fly", "dog", "church", "clue",
"dish");
for(i=0; i<9; i++) {
ps=
(5) ;
printf("%s: %s/n", wc[i], ps);
/*输出单词及
[填空题]以下程序的功能是:将值为三位正整数的变量x中的数值按照个位、十位、百位的顺序拆分并输出。请填空。
#include <stdio.h>
main( )
int x=256;
printf("%d-%d-%d/n",______,x/10%10, x/100);
[填空题]以下程序的功能是:将值为三位正整数的变量X中的数值按照个位、十位、百位的顺序拆分并输出。请填空
#include<stdio.h>
main( )
int x=256;
printf("%d-%d-%d/n",______,x/10%10,x/100);
[填空题]以下程序的功能是:将值为3位正整数的变量X中的数值按照个位、十位、百位的顺序拆分并输出。请填空。
#include<stdio.h>
main( )
int x=256;
printf("%d-%d-%d/n", ______, x/10%10, x/100);