运行以下程序,输入21252,写出程序运行结果。#include int fun(int number, int digit);int main(void){int count, in;scanf("%d", &in);count = fun(in, 2);printf("%d#%d\n", in, count);return 0;}int fun(int number, int digit){int count;if(number < 0) number = -number;count = 0;do{if(number % 10 == digit) count++;number = number / 10;}while(number != 0);return count;}
查看答案
运行以下程序,输入2 10,写出程序运行结果。#include #include int fun(int m);int main(){int count, i, m, n, sum;int prime(int m);scanf("%d%d", &m, &n);count = sum = 0;for(i = m; i <= n; i++)if(fun(i) != 0){count++;sum = sum + i;}printf("%d#%d\n", count, sum);}int fun(int m){int k, i;if(m == 1) return 0;k = sqrt(m);for(i = 2; i <= k; i++)if(m % i == 0) return 0;return 1;}
运行以下程序,输入1 4 3 0 2,写出程序运行结果。#include void ReadData(int a[], int n);void PrintData(int a[], int n);void fun(int a[], int n);void Swap(int *x, int *y);int main(){int a[5];ReadData(a, 5);fun(a, 5);PrintData(a, 5);return 0;}void ReadData(int a[], int n){int i;for (i=0; i x){x = a[i];xPos = i;}if (a[i] < y){y = a[i];yPos = i;}}temp = a[xPos];a[xPos] = a[yPos];a[yPos] = temp;}void Swap(int *x, int *y){int temp;temp = *x;*x = *y;*y = temp;}
运行以下程序,输入1 2 3 4 5,写出程序运行结果。#include void mov(int *x, int n, int m);int main(void){int a[5], i, *p;for(p = a, i = 0; i < 5; i++)scanf("%d", p++);mov(a,5,3);printf("After moved: ");for(i = 0; i < 4; i++)printf("%d#",a[i]);printf("%d",a[4]);return 0;}void mov(int *x, int n, int m){int i,j,k;for(i = 0; i < m; i++){k=x[n-1] ;for(j = n-1; j > 0; j--)x[j] = x[j - 1];x[0] = k;}}
我国脱贫攻坚成果举世瞩目,全国共有( )个贫困县全部摘帽。
A. 832
B. 830
C. 831
D. 833