#include <stdio.h> #include <stdlib.h> int main() { int mynumber,yournumber,count=0,; char c; do{ mynumber = (rand() % (101 - 1)) + 1; do{ printf("ÇëÊäÈëÄú²ÂÏëµÄÊýÖµ£º"); scanf("%d",&yournumber); count++; if(yournumber<mynumber) printf("Äú²ÂСÁË£º"); else if(yournumber>mynumber) printf("Äú²Â´óÁË£º"); } while(yournumber!=mynumber); printf("Äú²Â¶ÔÁË£¬ÄúÒ»¹²²ÂÁË%d´Î ",count); { if(count<=3) printf("ÄúÊÇÌì²Å"); if(count>3&count<=7) printf("ÖÇÁ¦Õý³£"); if(count>=8) printf("±¿"); } getchar(); c=getchar(); system("cls"); }while(c=='Y' || c=='y'); return 0; }
#include <stdio.h> #include <stdlib.h> int jishu(double x) { if(0<x&&x<=500) return 1; else if(500<x&&x<=2000) return 2; else if(2000<x&&x<=5000) return 3; else if(5000<x&&x<=20000) return 4; else if(20000<x&&x<=40000) return 5; else if(40000<x&&x<=60000) return 6; else if(60000<x&&x<=80000) return 7; else if(80000<x&&x<=100000) return 8; else return 9; } main() { double rate[10]={0.0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45}; int a[10]={0,0,25,125,375,1375,3375,6375,10375,15375}; double n,m,l; int i; printf("请输入工资:"); scanf("%lf",&l); if(l<=3500) printf("您不用交税 "); else { n=l-3500.0; i=jishu(n); m=n*rate[i]-a[i]; printf("应缴个人所得税:%.2lf 实发工资额:%.2lf ",m,l-m); }