#include <stdio.h> int gys(int a,int b)//此函数只能放在main上面;如果放在main下面,会报错“没有定义这个函数" 此函数的功能为求最大公约数 { if (b==0) return a; return gys(b,a%b); } int main() { int a = 520; int c1=98; int c2=56; char b = ‘F‘; float c = 3.14; double d = 3.141592653; printf("%d,%d\n",a,b); printf("%10d,%d\n",a,b); printf("%10d,%5d\n",a,b); printf("%-10d,%5d\n",a,b); printf("%-10d,%-5d\n",a,b); printf("%-10.2d,%-5.2d\n",a,b); printf("%-10.2f,%-5.2f\n",a,b); printf("鱼C工作室创办于2010年的%d\n", a); printf("I love %cishC.com!\n", b); printf("I love %dishC.com!\n", b); printf("圆周率是:%.2f\n", c); printf("圆周率是:%6.2f\n", c); printf("精确到小数点后9位的圆周率是:%11.9f\n", d); printf("精确到小数点后9位的圆周率是:%15.9f\n", d); printf("%d,%d的最大公约数为%d",c1,c2,gys(c1,c2)); return 0; }
原文:https://www.cnblogs.com/xkdn/p/14438101.html