Name: Anonymous 2010-11-14 14:57
written in C
my task was to make a script that reads [m;n]
and then does
m,m+1,m+2,...,m+n;
and prints only the numbers that have a residue equal to 3 or 6 after diving the m`s by 7
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main ()
{
int array[100],array3[100];
int n,i,y,m;
y=1;
printf("Type m\t");
scanf("%d",&m);
printf("Type n\t");
scanf("%d",&n);
for (i=0;i<=n;i++)
{
array[i]=m+i;
}
for (i=0;i<=n;i++)
{
if(3==array[i]%7)
{
array[i]=array3[y];
y++;
}
else
if (6==array[i]%7)
{
array[i]=array3[y];
y++;
}
}
for (y=1;y<=n;y++)
printf("%d\n",array3[y]);
return 0;
}
my task was to make a script that reads [m;n]
and then does
m,m+1,m+2,...,m+n;
and prints only the numbers that have a residue equal to 3 or 6 after diving the m`s by 7
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main ()
{
int array[100],array3[100];
int n,i,y,m;
y=1;
printf("Type m\t");
scanf("%d",&m);
printf("Type n\t");
scanf("%d",&n);
for (i=0;i<=n;i++)
{
array[i]=m+i;
}
for (i=0;i<=n;i++)
{
if(3==array[i]%7)
{
array[i]=array3[y];
y++;
}
else
if (6==array[i]%7)
{
array[i]=array3[y];
y++;
}
}
for (y=1;y<=n;y++)
printf("%d\n",array3[y]);
return 0;
}