Commit 4245d59e by glkink

Add new file

parent d9b76ec3
Showing with 68 additions and 0 deletions
#include <ctype.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
int main(void)
{
int i,j,sonadeArv, baas = 0;
printf("Sisesta sonade arv\n");
scanf("%d", &sonadeArv);
char sonad[sonadeArv][20];
int massiiv[sonadeArv];
printf("Sisesta %d sona:", sonadeArv);
for(i = 0; i < sonadeArv; i++)
{
scanf("%s", sonad[i]);
}
if (baas > 16){
return false;}
// If base is below or equal to 10, then all
// digits should be from 0 to 9.
else if (baas <= 10) {
for (int i = 0; i < strlen(sonad[i]); i++)
if (!(sonad[i] >= '0' && sonad[i] < ('0' + baas)))
return false;
}
else {
for (int i = 0; i < strlen(sonad[i]); i++)
if (! ((sonad[i] >= '0' && sonad[i] < ('0' + baas)) ||(sonad[i] >= 'A' && sonad[i] < ('A' + baas - 10))))
return false;
}
return true;
for (i = 0; i < sonadeArv; i++)
{
printf(" %s ",sonad[i]);
switch (massiiv[i])
{
case 0:
printf("kaheksandarv");
break;
case 1:
printf("kahendarv");
break;
case 2:
printf("16ndarv");
break;
case 3:
printf("sona");
break;
default:
printf(" ");
break;
}
printf("\n");
}
return 0;
}
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