Добавил:
Upload
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Информатика_1 / 241251251
.txt#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>
#include <math.h>
void main()
{
int q,p,i=0;
int a;
int x[4];
FILE *fp;
fp=fopen("C:\\out.txt ","rb");
if (fp==NULL) printf("mistake");
else
{
while (fscanf(fp,"%d",&x[i])!=NULL)
{
printf("%d ",x[i]);
i++;
}
/* while(x!=0)
{
q=a%10;
if((q/3==0) && (q!=0) && (q!=1)){
printf("%f ",q);
p++;
}
a-=q;
a/=10;
}*/
}
printf("\nkol-vo=%d",p);
fclose(fp);
getch();
}
ааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааа
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>
#include <math.h>
void main()
{ double c1,c2,c3;
int p=0,i=0;
int x[4];
FILE *ft;
FILE *fp;
fp=fopen("C:\\out.txt ","rb");
ft=fopen("ot.txt ","wb");
if (fp==NULL) printf("mistake");
else
{
while (fscanf(fp,"%d",&x[i])!=NULL)
{
c1=x[i]/100;
c2=x[i]%10;
c3=x[i]/10%10;
if ((c1==2) || (c2==2) || (c3==2))
{
fprintf(ft,"%d",x[i]);
p++;
}
i++;
}
}
printf("%d",p);
fclose(fp);
fclose(ft);
getch();
}
Соседние файлы в папке Информатика_1