- 博客(11)
- 收藏
- 关注
原创 输入a和b两个整数,按先大后小的顺序输出a和b
/* Note:Your choice is C IDE */#include "stdio.h"main(){ int*p1,*p2,*p,a,b; printf("please enter two number:"); scanf("%d,%d",&a,&b); p1=&a; p2=&b; if(a<b) {p=p1;p1=p2;p
2014-05-06 19:40:16
2483
原创 两个数的平方和的平方根
/* Note:Your choice is C IDE */#include "stdio.h"#include "math.h"main(){ double pfh(double x,double y); double a,b; double c; double d; scanf("%lf,%lf",&a,&b); c=pfh(a,b); d=sqrt(c); pr
2014-04-22 20:09:33
2969
原创 请使用rand函数,来写一个上午上课随机点名的小程序,要求执行该程序后会输出被提问学生的学号。(注意,咱班有45个人,学号为1~45)
/* Note:Your choice is C IDE */#include "stdio.h"#include"stdlib.h"main(){ int i,j; i=rand(); j=i%45+1; printf("%d",j); }
2014-04-15 19:05:59
2196
原创 随机函数
/* Note:Your choice is C IDE */#include "stdio.h"#includemain(){ int i; i=rand(); printf("%d"); }
2014-04-15 18:45:34
395
原创 使用do while循环,计算2+4+6+...+100
#include "stdio.h" void main() { int a,b; a=2; b=0; do{ b=b+a; a=a+2; }while(a<=100); printf("%d",b); }
2014-04-07 23:21:16
2550
原创 7.使用while循环,计算2+4+6+...+100
#include "stdio.h" void main() { int a,b; b=0; a=2; while(a<=100) { b=b+a; a=a+2; } printf("%d",b );}
2014-04-07 23:14:34
3955
1
原创 5.输入一个整数,如果该整数介于1到12之间,则输出对应的月份,比如输入为4,则输出”April“ -_-!;否则输出”not valid month number“
2014-04-07 23:04:49
1185
原创 使用for循环,计算2+4+6+...+100
#include void main() { int i,sum=0; for(i=2;i<102;i=i+2) sum+=i; printf("The sum of them is %d",sum); }
2014-04-07 22:57:41
3949
原创 输入一个整数,把该整数分别按照八进制、十进制、十六进制形式输出
#includemain(){ int x; printf("x="); scanf("%d",&x); printf("x=%#o\n",x); printf("x=%#d\n",x); printf("x=%#x\n",x); }
2014-04-01 20:30:06
5732
原创 输入一个整数,如果该整数大于1000,则输出“big”,如果该整数介于100到1000之间(包含两个边界),则输出“middle”,如果上面两种情况都不满足,输出”small“
#include "stdio.h"main(){ int x; printf("x="); if(x>1000) printf("big"); if(x>=100&&x<1000) printf("middle"); else printf("small"); }
2014-04-01 20:22:09
1017
原创 输入一个整数,如果该整数x符合条件:-1<x<10,则输出“ok”,否则输出“not ok”
include main() { int x; scanf("%d",&x); if(x>-1&&<10) printf("ok"); else printf(not ok); }
2014-04-01 20:20:09
642
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅