nnpc.net
当前位置:首页 >> C语言编程,假设x是一个整数,写一个程序:从键盘... >>

C语言编程,假设x是一个整数,写一个程序:从键盘...

#include "stdio.h"int main(){ int x,y; scanf("%d",&x); y=2*x+5; printf("%d",y);}

#include "stdio.h" #include "math.h" int main() { int x,y,z; double s; int i = 0; scanf("%d %d", &x, &y); s = pow(x, y); printf("%d^%d=%.lf\n", x, y, s); z = s; while (i < 3 && z) { printf("%d ", z % 10); z /= 10; i++; } return...

#include int isz(int n){ int i; if(n

#includeint main(){int x,y;float r;scanf("%d%d",&x,&y);r = (float)x/y*100;printf("a占b的百分比为%.f%%\n", r);}

#include void main() { int x; scanf("%d",&x); if(x%2==0) printf("%d is Even number\n",x); else printf("%d is Odd number\n",x); }

c语言实现:#includeint main(){float a,b,c;printf("please enter number1:");scanf("%f",&a);printf("please enter number2:");scanf("%f",&b);c = (a+b)/2;printf("the result is %.1f\n",c);return 0;}

#include #include int main(){ int n=0; char ch; while((ch=getchar())!='\n') { n+=ch-'0'; } printf("%d\n",n); system("pause");}

我直接写核心了: int a[10]; for (i=1;i

#include int main() { unsigned int n; printf("请输入一个正整数:"); scanf("%d",&n); if(n%2==0) printf("偶数\n"); else printf("奇数\n"); return 0; }

#include "stdio.h" int main(void) { int i=0,sum=0; printf("输入一个数:"); scanf("%d",&i); while(i>0){ sum=sum+(i%10); i=i/10; } printf("和:%d\n",sum); return 0; }

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