Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
avance 2 guía 4
#include <stdio.h> #include <ctype.h> #include <string.h> #include <stdlib.h> typedef struct { char number[101]; unsigned short x; unsigned short y; }datos; unsigned short checkTheNumber(char *, unsigned short); int main(void) { unsigned short i; unsigned short N; scanf("%hu\n", &N); datos numeros[N]; for (i = 0 ; i < N ; i++) scanf("%100s %hu %hu", numeros[i].number, &numeros[i].x, &numeros[i].y); /* for (i = 0 ; i < N ; i++) printf("%s %hu %hu\n", numeros[i].number, numeros[i].x, numeros[i].y);*/ for (i = 0 ; i < N ; i++) if (checkTheNumber(numeros[i].number, numeros[i].x)) printf("%s Base valida\n", numeros[i].number); else printf("%s Base no valida\n", numeros[i].number); return 0; } unsigned short checkTheNumber(char *number, unsigned short base) { int digit; if (base < 11) { while ( *number != '\0') { if ( isalpha( *number )) return 0; digit = ( (int) *number ) - 48; if (digit >= base) return 0; number ++; } } else { } return 1; }
run
|
edit
|
history
|
help
0
Undefined argument processing order in C
Assignment 7
22nd HW Switchv0.2
Project 3 Part 1 v1.5
problem4 review fundamentos
Intro coding hello world
C(gcc) Local Time and math.h Example
Coba
C programming example implementing a function to set a specified bit in an int (from ECE 2534)
Factorial_LOOP