标签:style break char void draw ati turn lin lazy
#include<stdio.h> long long fac( int n ); int main() { int i,n; printf("Enter n:"); scanf("%d",&n); for( i=1;i<=n;++i ) { printf("%d!=%11d\n",i,fac(i)); } return 0; } long long fac( int n ) { static long long p=1; printf("p=%d ",p); p *= n; return p; }
#include<stdio.h> #define N 1000 int fun( int n,int m,int bb[N] ) { int i,j,k=0,flag; for( j=n;j<=m;j++ ) { flag=1; for( i=2;i<j;i++ ) { if( j%i==0 ) { flag=0; break; } } if( flag!=0 ) bb[k++]=j; } return k; } int main() { int n=0,m=0,i,k,bb[N]; scanf("%d",&n); scanf("%d",&m); for( i=0;i<m-n;i++ ) { bb[i]=0; } k=fun( n,m,bb ); for( i=0;i<k;i++ ) printf("%4d",bb[i]); return 0; }
#include<stdio.h> long long fun( int n ); int main() { int n; long long f; while( scanf("%d",&n) != EOF ) { f=fun(n); printf("n=%d,f=%11d\n",n,f); } return 0; } long long fun( int n ) { long long i,sum=1; for( i=1;i<=n;i++ ) { sum*=2; } return sum-1; }
#include<stdio.h> void draw( int n,char symbol ); int main() { int n,symbol; while( scanf("%d %c",&n,&symbol) != EOF ) { draw( n,symbol ); printf("\n"); } return 0; } void draw( int n, char symbol ) { int line=0,i=0; for( line=1;line<=n;line++ ) { for( i=1;i<=5-line;i++ ) { printf(" "); } for( i=1;i<=2*line-1;i++) { printf("%c",symbol); } printf("\n"); } }
标签:style break char void draw ati turn lin lazy
原文地址:https://www.cnblogs.com/zhysm817/p/14111471.html