有以下程序#include <stdio.h>double fun(double a){ double x;x = a - (int)a;return x;}main(){ double a = 3.1415;printf("%f\n", fun(a));}程序的运行结果是______。
A: 0.141500
B: 3.141500
C: 3.000000
D: 0.000000
A: 0.141500
B: 3.141500
C: 3.000000
D: 0.000000
举一反三
- 有以下程序 #include double f (double x); main() { double a=0; int i; for(i=0;i<30;i+=10) a+=f((double)i); printf("%3.0f\n",a); } double f(double x) {return x*x+1;} 程序运行后的输出结果是()
- 下面程序的功能是:fun函数实现一个整数x的y次方计算,main函数中调用fun函数,计算x的y次值。请填空。#include<stdio.h>int main( ){ double fun( double x , int y ) ;int y = 3 ;double x = 4 , z ;______;printf( "z=%f\n" , z ) ;return 0 ;}double fun( double x , int y ) {int i ;double z = 1 ; for( i = 1 ; i <= y ; i++ ) _____;return z ; }
- 有以下程序: #include double f(double x);main(){ double a =0;int i; for(i=0;i<30;i+=10) a+=f((double)i); printf("%3.0f\n",a);}double f(double x){ return x*x+1;}程序的运行结果是( ) A: 5050 B: 401 C: 503 D: 1404
- 有以下程序 #include double fun(double s,double a,double b) { a = (int)(s); b = s-a; return a+b; } main ( ) { double s=12.654,a=11,b=22; printf("%5.2lf,",fun(s,a,b)); printf("%5.2lf,%5.2lf\n",a,b); }程序运行后的输出结果是
- 有以下程序 double f (double x); main() { double a=0; int i; for ( i=0; i<30; i+=10 ) a += f( (double)i ); printf ("%3.0f\n", a); } double f (double x) { return x*x+1; } 程序运行后的输出结果是 A: 503 B: 401 C: 1404 D: 500