C语言习题
摘要:5#include<stdio.h>#defineOK(i,t,n)((i%t==0)&&(i/t<n))intfun(intt1,intt2,intt3,intt4,intn){intcount,t,maxt=t1;if(maxt<t2)maxt=t2;if(maxt<t3)maxt=t3;if(maxt<t4)maxt=t4;count=1;10152025/*给count赋初值*/for(t=1;t<maxt*(n-1);t++){if(OK(t,t1,n)||OK(t,t2,n)||OK(t,t3,n)||OK(t,t4,n))count++;}returncount;}voidmain(){intt1=7,t2=5,t3=6,t4=4,n=10,r;r=fun(t1,t2,t3,t4,n);printf("Thesound:%d\n",r);}#include<stdio.h>#include<math.h>doublefun(intn){510152025intm,k,i;doubles=0.0;for(m=3;m<=n;m++){k=sqrt(m);for(i=2;i<=k;i++)if(m%i==0)break;if(i>=k+1)s+=sqrt(m);}returns;}voidmain(){intn;doublesum;FILE*out;printf("InputN=");scanf("%d",&n);sum=fun(n);printf("\n\nsum=%f\n\n",sum);/*************************
温馨提示:当前文档最多只能预览
5 页,若文档总页数超出了
5 页,请下载原文档以浏览全部内容。
本文档由 匿名用户 于 2020-11-13 00:29:25上传分享