/************found************/
if(a[i]>a[M-1])
a[M-1]=a[i];
printf("Maxis%d\n",a[M-1]);
}
#include"stdio.h"
#include"math.h"
#include"conio.h"
#include"stdlib.h"
#defineN20
main()
{inta[N]={1,20,8,14,7,12,2,19,19,15,13,14,20,10,16,20,7,6,12,12};
doubleav;
FILE*f;
/***********begin***********/
#include"stdio.h"
#include"math.h"
#include"conio.h"
#include"stdlib.h"
#defineN20
main()
{inta[N]={1,20,8,14,7,12,2,19,19,15,13,14,20,10,16,20,7,6,12,12};
doubleav;
FILE*f;
/***********begin***********/
inti;floats=a[0];
for(i=1;i<20;i++)
s+=a[i];
av=s/N;
/************end************/
printf("Aver=%f\n",av);
f=fopen("D:
\\exam\\05700904\\PROGOUT.DAT","w");
fprintf(f,"Average=%.2f\n",av);
fclose(f);
}
/************end************/
printf("Aver=%f\n",av);
f=fopen("D:
\\exam\\05700904\\PROGOUT.DAT","w");
fprintf(f,"Average=%.2f\n",av);
fclose(f);
}
#include
#include
intarrmin(intarr[3][3])
{inti,j,min;
/************found************/
min=arr[0][0];
for(i=0;i<3;i++)
for(j=0;j<3;j++)
if(min>arr[i][j])
min=arr[i][j];
return(min);
}
main()
{inta[3][3]={4,4,34,7,3,12,5,6,5},i,j,n;
/************found************/
n=arrmin(a);
printf("Theminis:
%d\n",n);
}
#include
main()
{inti,a[10];
clrscr();
for(i=1;i<=10;i++)
/**************found************/
a[i-1]=i;
for(i=0;i<5;i++)
/**************found************/
a[9-i]=a[i];
for(i=0;i<10;i++)
printf("%5d",a[i]);
printf("\n");
}
#include
#include
intfun(intm)
{
/***********begin***********/
m=(m/100)*((m/10)%10)*(m%10);
return(m);
/************end************/
}
main()
{intm,s;
printf("Enterm:
\n");
scanf("%d",&m);
s=fun(m);
printf("Resultis:
%d\n",s);
NONO();
}
NONO()
{FILE*fr,*fw;
inti,j,k,m;
fr=fopen("D:
\\exam\\05700905\\PROGIN.DAT","r");
fw=fopen("D:
\\exam\\05700905\\PROGOUT.DAT","w");
for(i=1;i<=5;i++)
{fscanf(fr,"%d",&m);
fprintf(fw,"Productis%d\n",fun(m));}
fclose(fr);
fclose(fw);
}
#include
#include
main()
{inta[10]={10,4,2,7,3,12,5,34,5,9},i,s;
floataver;
s=a[0];
/************found************/
for(i=1;i<10;i++)
s=s+a[i];
aver=(double)s/i;
/************found************/
printf("Theaveris:
%f\n",aver);
}
#include
#include
main()
{
intnum,k;
clrscr();
/************found************/
k=0;
printf("Pleaseenteranumber:
");
scanf("%d",&num);
do
{
/************found************/
k=k+num%10;
num/=10;
}while(num);
printf("\n%d\n",k);
}
#include
#include
fun(charstr1[])
{
/***********begin***********/
inti,count=0;
for(i=0;i<80;i++)
{if(str1[i]>='0'&&str1[i]<='9')
count++;
}
return(count);
/************end************/
}
main()
{charstr1[80]="2007-August-15";
intn;
clrscr();
printf("Stringis:
%s\n",str1);
n=fun(str1);
printf("Resultis:
%d\n",n);
NONO();
}
NONO()
{FILE*fr,*fw;
inti;
chars[80];
fr=fopen("D:
\\exam\\05700906\\PROGIN.DAT","r");
fw=fopen("D:
\\exam\\05700906\\PROGOUT.DAT","w");
for(i=1;i<=5;i++)
{fgets(s,80,fr);
fprintf(fw,"TheResultis:
%d\n",fun(s));
}
fclose(fr);
fclose(fw);
}
#include
main()
{floatx[1000],sum=0.0,ave,a;
intn=0,i;
printf("Enterdigit:
\n");
scanf("%f",&a);
while(a>=0.0&&n<1000)
{
/************found************/
sum+=a;
x[n]=a;
/************found************/
n+=1;
scanf("%f",&a);
}
ave=sum/n;
printf("Output:
\n");
printf("ave=%.2f\n",ave);
}
#include
#include
intfun(charstr[])
{
/***********begin***********/
inti=0,count;
for(i=0;str[i]!
='\0';i++)
count=i+1;
returncount;
/************end************/
}
main()
{charstr1[80]="ThisIsacProgram";
intcount;
clrscr();
printf("Stringis:
%s\n",str1);
count=fun(str1);
printf("Resultis:
%d\n",count);
NONO();
}
NONO()
{FILE*fr,*fw;
inti,j;
chars1[80];
fr=fopen("D:
\\exam\\05700907\\PROGIN.DAT","r");
fw=fopen("D:
\\exam\\05700907\\PROGOUT.DAT","w");
for(i=1;i<=5;i++)
{fscanf(fr,"%s",s1);
fprintf(fw,"%d\n",fun(s1));
}
fclose(fr);
fclose(fw);
}
#include
#include
main()
{inta[10]={10,4,2,7,3,12,5,34,5,9},i;
floataver,s;
clrscr();
s=a[0];
/************found************/
for(i=1;i<10;i++)
/************found************/
s=s+a[i];
aver=s/i;
printf("Theaveris:
%.2f\n",aver);
}
#include
#defineM100
main()
{inta,b,c,i;
clrscr();
a=0;c=0;
/**************found************/
for(i=1;i<=M;i+=2)
{a+=i;
/**************found************/
b=i+1;
c+=b;}
printf("sumofevensis%d\n",c);
printf("sumofoddsis%d\n",a);
}
#include"stdio.h"
#include"math.h"
#include"conio.h"
#include"stdlib.h"
main()
{intm=9,n=84,s1,s2,i;
/***********begin***********/
i=1;
while(i!
=0)
{i=n%m;n=m;s1=m;m=i;
}
m=9,n=84;
s2=m*n/s1;
/************end************/
printf("TheHighestcommondivisorof%dand%dis%d\n",m,n,s1);
printf("TheLowestcommonmultipleof%dand%dis%d\n",m,n,s2);
NONO(m,n,s1,s2);
}
NONO(intm,intn,ints1,ints2)
{FILE*fw;
fw=fopen("D:
\\exam\\05700908\\PROGOUT.DAT","w");
fprintf(fw,"MaximalCommonDivisorOf%dand%dis%d\n",m,n,s1);
fprintf(fw,"MinimalCommonMultipleOf%dand%dis%d\n",m,n,s2);
fclose(fw);
}
#include
#include
main()
{inta[10]={1,4,2,7,3,12,5,34,5,9},i,min,pos;
clrscr();
/************found************/
min=a[0];
pos=0;
for(i=1;i<10;i++)
if(min>a[i])
{
min=a[i];
/************found************/
pos=i;
}
printf("Theminis:
%d,posis:
%d\n",min,pos);
}
#include
#defineM11
main()
{inta[M],i;
clrscr();
for(i=0;iscanf("%d",&a[i]);
/************found************/
a[M-1]=a[0];
for(i=1;i/************found************/
if(a[i]>a[M-1])
a[M-1]=a[i];
printf("Maxis%d\n",a[M-1]);
}
#include"stdio.h"
#include"math.h"
#include"stdlib.h"
main()
{doublepi;
floati;
/***********begin***********/
/************end************/
printf("pi=%.5f\n",pi);
NONO(pi);
}
NONO(doublex)
{FILE*f;
f=fopen("D:
\\exam\\05700909\\PROGOUT.DAT","w");
fprintf(f,"pi=%.5f\n",x);
fclose(f);
}
#include
#include
intmax;
fun(intarr[],intn)
{intpos,i;
max=arr[0];
pos=0;
for(i=1;iif(max{
max=arr[i];
/************found************/
pos=i;
}
return(pos);
}
main()
{inta[10]={1,4,2,7,3,12,5,34,5,9},n;
clrscr();
/************found************/
n=fun(a,10);
printf("Themaxis:
%d,posis:
%d\n",max,n);
}
#include
#include
#include
/************found************/
longintfun(intx)
{inti;
longints=1;
for(i=2;i<=x;i++)
s*=i;
return(s);
}
main()
{longintm=12,n=2,s1,s2,s3;
/************found************/
s1=fun(m);
s2=fun(n);
s3=fun(m-n);
printf("Cmnis:
%ld",s1/s2/s3);
}
#include"stdio.h"
#include"math.h"
#include"stdlib.h"
main()
{doublesum;
/***********begin***********/
doublei;sum=0.0;
for(i=1.0;;i=i+2)
{sum+=1.0/(i*i);
if(1.0/(i*i)<1e-6)
break;
}
/************end************/
printf("sum=%.3f\n",sum);
NONO(sum);
}
NONO(doublex)
{FILE*f;
f=fopen("D:
\\exam\\05700910\\PROGOUT.DAT","w");
fprintf(f,"sum=%.3f######\n",x);
fclose(f);
}
#include
#include
main()
{inta[10]={10,4,2,7,3,12,5,34,5,9},i,s;
floataver;
clrscr();
s=a[0];
/************found************/
for(i=1;i<10;i++)
s=s+a[i];
aver=(double)s/i;
/************found************/
printf("Theaveris:
%f\n",aver);
}
#include
main()
{inta[10]={1,5,2,5,6,8,7,4,3,0};
inti,k,n,f=0;
clrscr();
scanf("%d",&n);
for(i=0;i<10;i++)
/************found************/
if(a[i]==n)
{f=1;
/************found************/
k=i;
}
if(f)
printf("%disNo.%d\n",n,k);
else
printf("%dnotfound!
\n",n);
}
#include
#include
main()
{inta[10]={10,4,2,7,3,12,5,34,5,9},i,s;
clrscr();
s=0;
/************found************/
for(i=0;i<10;i++)
if(a[i]%2==0)
/************found************/
s=s+a[i];
printf("Theresultis:
%d\n",s);
}
#include
#defineM100
main()
{inta,b,c,i;
clrscr();
a=0;c=0;
/**************found************/
for(i=1;i{a+=i;
/**************found************/
b=i+1;
c+=b;}
printf("sumofevensis%d\n",c);
printf("sumofoddsis%d\n",a);
}
#include"stdio.h"
#include"math.h"
#include"stdlib.h"
main()
{doublepi;
longinti;
/***********begin***********/
pi=1.0;
for(i=1;i<=400;i=i+2)
pi=pi*(1.0+1.0/(i*(i+2.0)));
pi=pi*2.0;
/************end************/
printf("pi=%.5f\n",pi);
NONO(pi);
}
NONO(doublex)
{FILE*f;
f=fopen("D:
\\exam\\05700810\\PROGOUT.DAT","w");
fprintf(f,"pi=%.5f\n",x);
fclose(f);
}
#include
#include