Commit e89d5a2d by Jürgen Hein

katsetus int kontrolliga Kodutoo2MassiividLiitmine.c

parent 4b993b2e
Showing with 15 additions and 3 deletions
/* Kodutöö 2. Variant 4.
/* Kodutöö 2. Variant 4.
......@@ -39,15 +39,27 @@ int main(void)
int Sisestus(char teade[])
{
int arv;
int i;
int Kontroll;
int S[] = {1,2,3,4,5,6,7,8,9,10};
do
{
printf("%s\n", teade);
scanf("%d", &arv);
if(arv <= 1 || arv >= 10)
Kontroll = 0;
for(i=0;i<max;i++)
{
if(arv == S[i]) //Kontroll, kas väärtus on täisarv vahemikus 1...10.
{
Kontroll = 1; //Sisestus sobib piirkonda
}
}
if(Kontroll == 0)
{
printf("Sisestatud väärtus ei sobi, sisestage täisarv vahemikus 1...10.");
}
} while(arv <= 1 || arv >= 10);
}while(Kontroll == 0);
return arv;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment