xcxd.net
当前位置:首页 >> 用C语言写A B >>

用C语言写A B

#include<stdio.h> int main() { int a,b,c,result; printf("please input a,b,c:"); scanf("%d,%d,%d",&a,&b,&c);//输入时,每个数据用逗号隔开;如:1,2,3 result=a+b*c; printf("the result of a+b*c is %d",result); return 0; }

#include<stdio.h> int main(void) { char ch; printf("Please input a character:"); ch = getchar(); if((ch >= 'a' &&ch < 'z') || (ch < 'Z' && ch >= 'A')) putchar(ch+1); else if(ch == 'z') putchar('a'); else if(ch == 'Z') putchar('A'); else puts("Error!"); printf("\n"); return 0; }

方法一: scanf("%d%d,&a,&b"); if (a>b) { max = a ; } else { max = b ; } printf("%d" ,a); } 方法二: main() { int a,b,max; scanf("%d%d",&a,&b); max = (a>b)?a:b; printf("%d",max); }

#include int a,b,m,n; scanf("%d",&a); scanf("%d",&b); m=a+b; n=a/b; printf("%d,%d\n",m,n);

是这样吗? #include <stdio.h> int main(int argc, char *argv[]) { int a=2, b=3, c; printf("2+3=?\n"); scanf("%d", &c); if(c==a+b) printf("回答正确%d + %d = %d\n", a, b, a+b); else printf("回答错了结果是%d + %d = %d", a, a+b); return 0; }

程序如下:#include <stdio.h>#include <stdlib.h> int main(int argc, char *argv[]) { int a,b; scanf("%d %d",&a,&b); printf("%d",a+b); system("PAUSE"); return 0; } C语言编写简单程序具体操作步骤:1、头文件:基本都会带有三个头文件,这

#include void main() { int a,b,c; printf("please enter a,b:\n"); scanf("%d%d",&a,&b); c=a+b; printf("%d+%d=%d\n",a,b,c); }

|是c语言中位操作符,a|b是a与b按位进行或操作.

#include void main() { int a,b; scanf("%d",&a); scanf("%d",&b); if(b>0)printf("%d\n",a+b); else printf("%d\n",a-b); }

#include<stdio.h>#include<math.h> int main() {int a,b,c; scanf("%d%d",a,b); c=pow(a,b); printf("%d",c); return 0; }

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