第8次实验任务
来源:互联网 发布:java短期培训学校 编辑:程序博客网 时间:2024/04/27 15:54
任务一
程序
#include "stdafx.h"#include <math.h> #include <stdio.h> int zh(int x){int y;y=0;while (x>0){y=y*10+x%10;x=x/10;}return y;}void main(){int a,b,c,d,e;d=0;printf ("输入两个数字:");scanf_s("%d %d",&a,&b);if (a>-1000&&a<10000&&b>-1000&&b<10000){c=zh(a);d=zh(b);e=zh(c+d);printf("%d",e);}}
任务二
#include "stdafx.h"long gt(long x){long y=1;while(x>0){y=x*y;x=x-1;}return y;}void main(){long a,b;a=20;b=0;while (a>0){b=gt(a)+b;a=a-1;}printf("1!+2!+3!`````+20!=%d",b);}
任务三
#include "stdafx.h"#include<math.h> char ab( int x){int i; char a='N',b='Y'; for(i=2;i<=sqrt((double)x);i++) { if(x%i==0) { return a; } elsereturn b; } }void main(){ int a;while(1){printf ("输入一个整数:");scanf_s("%d",&a);{if(a<2)printf("质数是不能小于2,请重新输入");elseprintf("%c\n",ab(a)); }}}
- 第8次实验任务
- 第8次实验任务
- 第8次实验任务
- 第8次实验任务
- 第 1次实验任务
- 第 1次实验任务
- 第 1次实验任务
- 第1次实验任务
- 第2次实验任务
- 第1次实验任务
- 第 2次实验任务
- 第2次实验任务
- 第2次实验任务
- 第 3次实验任务
- 第 3次实验任务
- 第 3次实验任务
- 第3次实验任务
- 第 3次实验任务
- 你的代码有教育后人的义务与责任
- 让开发者高效编程的10个新框架
- 如何提高程序员的价值
- 是广告还是病毒
- C++的多态性
- 第8次实验任务
- USB 描述符详细解析,来自老外网站,比协议描述清晰
- RMI学习以及深入讲解
- B. Multithreading
- 千万级并发实现的秘密:内核不是解决方案,而是问题所在!
- 2013-5-17杂乱草稿纸
- 计算出两个日期相隔多少天
- PHP foreach的两种用法 as $key => $value
- java POI 导入两行数据OutOfMemoryError