以下程序的运行结果为( ) #include[stdio.h] int main() { int answer,result; answer=100; result=answer-10; printf("The result is %i\n",result+5); return 0; }
举一反三
- 【单选题】下面 C代码的输出结果是()。int answer,result;answer=100;result=answer-10;printf( “The result is %d” , result+5); A. The result is 90 B. The result is 95 C. The result is 10 D. The result is 100
- 下面程序的运行结果是( )。 #include<iostream.h> int fun(int a[],int n) int result=1; for(int i=1;i<n;i++) result=result *a[i]; return result; void main() int a[3]=3,4,5; eout<<fun(a,3)<<end1;[/i] A: 12 B: 15 C: 20 D: 60
- 下面程序段的输出结果是( )。 public class Test public static void main ( String[] args) int result=0; for ( int i=1;i<=5;i++) if ( i%2==0 ) continue; result + =i; System. out. println ("result is " + result ); A: result is 7 B: result is 8 C: result is 9 D: result is 10
- 下面程序段的输出结果是( )。 public class Test public static void main (String[] args) int n=10,result=0; for (int i=1;i<=n;i++) result+=i; System.out.println("result is"+result); A: A) result is 55 B: B) result is 45 C: C) result is 56 D: D) result is 54
- 以下代码的运行结果为 def calculate(number): result = 0 i = 1 while i <= number: result = result + i i += 1 return result result = calculate(100) print('1~100的累积和为:', result)