dfkt.net
当前位置:首页 >> 大一C语言编程题库 >>

大一C语言编程题库

第一题:#include "stdio.h" void main() { int a,b,sum=0; for(a=0;a main() { char a; int b,c,d,e; b=0;c=0;d=0;e=0; /* b是字母 c是数字 d是符号 e是空格*/ fflush(stdin); printf(

#include<stdio.h> int main() { int n,sum,a,b,c; printf("请输入一个三位数\n"); scanf("%d",&n); if(n<100||n>999) printf("error input!"); else { a=n%10; b=n/10%10; c=n/100; sum=a*a*a+b*b*b+c*c*c; printf("%d\n",sum); } return 0; }

a. 杨辉三角:代码如下:-------------------------------------------------------#include <stdio.h>int main(int argc, char *argv[]){ int a[10][10] = {1}; int i, j; for (i = 1; i < 10; i++) { a[i][0] = 1; a[i][i] = 1; for (j = 1; j < i; j++) { a[i][j] = a[i - 1][j - 1] + a[i - 1][j]; } } for (i = 0; i < 10

一、单项选择题(每小题2分,共50分)1、一个C程序的执行是从___A__. A、本程序的main函数开始,到main函数结束 B、本程序的main函数开始,到本程序文件的最后一个函数结束 C、本程序文件的第一个函数开始,到本程序文件的最后

如果只是你给出的那些例子下面的程序就可以完成,不需要高精度的除法.我需要知道数据范围.#include int main() { int n1,n2,t,n; scanf("%d",&t); while(t--) { scanf("%d",&n); n1 = 0; n2 = 0; while(n % 2 == 0) n/=2 , n1++; while(n % 5 == 0)

#include<stdio.h>typedef struct student{ int Grade; int Count; }HIS; void print(int n){ while(n--){ printf("★ "); } } void main(){ HIS gra[40]; int n=0; while(n<40){ printf("请输入第%d个学生的打分(1~10分):",n+1); gra[n].Grade=n+1; scanf(

/* 1. */ #include #include char* ReadFile(const char* psz) { FILE* fp = fopen(psz, "r"); if( NULL == fp ) return NULL; fseek(fp, 0, SEEK_END); int nLen = ftell(fp); char* pszBuff = (char*)malloc(nLen + 1); fseek(fp, 0, SEEK_SET); int nSize = fread(

#include <stdio.h>#include <stdlib.h> void maxInput() { int a, b; printf("input two number.\n"); scanf("%d %d", &a, &b); printf("max number is %d.\n", (a>b)?a:b); } void fun() { int i, sum=0; for(i=0; i<=1000; i++) { if(i%2) continue; sum+=i; } printf("sum = %d.\n", sum); }

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #include <stdio.h> #include <stdlib.h> int main() { float array[] = {74.1, 48.5, 5.9, 80.6, 27.4, 94.8, 53.1, 24.2, 66.5, 39.8, 54.3, 86.0, 63.8, 54.7, 57.6, 10.7, 61.4, 86.4, 65.9, 81.9, 96.0, 32.4, 98.5, 27.8, 23.2, 13.

#include <stdio.h>int fun(int n){ int i; if(n>2 && !(n&1) || n<2) return 0; for(i=3;i*i<=n;i+=2) if(!(n%i)) return 0; return 1;}int main(void){ int s[8],i; printf("Input 8 integers\n"); for(i=0;i<8;scanf("%d",s+i++)); printf("The prime Numbers:\n"); for(i=0;i

9371.net | jamiekid.net | fkjj.net | 9371.net | ltww.net | 网站首页 | 网站地图
All rights reserved Powered by www.dfkt.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com