#include <stdio.h> #include <stdlib.h> #include <time.h> #define N 5 int main() { int grade, number; int i; srand(time(0)); for(i=0; i<N; ++i) { grade = rand()%4 + 2018; number = rand()%999 + 1; printf("%d8330%04d/n", grade, number); } return 0; }
#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,b,i; b=rand()%30+1; for (i=0;i<3;i++) { printf("猜猜四月哪天是你的luckyday/n"); scanf("%d",&a); if(a==b) printf("猜对了哦/n"); else if(a<b) printf("早了一点啦/n"); else printf("迟了一会哦/n"); } return 0; }
#include<stdio.h> int main() { for(;;) { char i; i=getchar(); getchar(); if(i=='w') printf("wait a minute/n"); else if(i=='g') printf("go go go/n"); else if(i=='s') printf("stop/n"); else printf("someting must be wrong/n"); } return 0; }
#include <stdio.h> #include <stdlib.h> #include <math.h> float fenmu(int a,int n) { int i; float tt=0; for(i=0;i<n;i++) { tt+=a*pow(10,i); } return tt; } float fenshu(int a,int n) { int i; float t=0; float sum=0; float s=0; for(i=1;i<=n;i++) { s=fenmu(a,i); t=i/s; sum+=t; } return sum; } int main() { int a,n; printf("请输入a和n/n"); while(scanf("%d%d",&a,&n)!=EOF) { float k=fenshu(a,n); printf("%f/n",k); } }
#include<stdio.h> #include<stdlib.h> int main() { int num1, num2; for (num1 = 1; num1 <= 9; num1++) { for (num2 = 1; num2 <= num1; num2++) { printf("%d×%d=%-3d", num1, num2, num1*num2); } printf("/n"); } system("pause"); return 0; }
#include<stdio.h> int main() { int n,i; scanf("%d",&n); for(i=1;i<=n;i++) { printf(" o /n"); printf("<h>/n"); printf("I I/n"); } return 0; }
#include<stdio.h> int main() { int n,i; scanf("%d",&n); for(i=1;i<=n;i++) { printf(" o "); } printf("/n") ; for(i=1;i<=n;i++) { printf("<h> "); } printf("/n") ; for(i=1;i<=n;i++) printf("I I "); printf("/n") ; return 0; }
#include<stdio.h> int main() { int n,i,j,m,t; printf("input n:"); scanf("%d", &n); for (j =1; j<=n; j++) { t = 5* (j - 1); printf("%*s", t, ""); for (i = j; i <= 2*n-j; i++) printf(" o "); printf("/n"); t = 5 * (j - 1); printf("%*s", t, ""); for (i = j; i <= 2*n-j; i++) printf("<H> "); printf("/n"); t = 5 * (j - 1); printf("%*s", t, ""); for (i = j; i <= 2*n-j; i++) printf("I I "); printf("/n"); } return 0; }
原创文章,作者:254126420,如若转载,请注明出处:https://blog.ytso.com/245380.html