Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void seleccionNumero(int a[5],int b){
- char x[6] = {0,0,0,0,0,0};
- int k = 0;
- while(k == 0){
- printf("Seleccione un numero de %i cifras distintas entre si: ",b);
- scanf("%s",&x);
- switch (b){
- case 2:
- if((x[0] >= 48) && (x[0] <= 57)){
- if((x[1] >= 48) && (x[1] <= 57)){
- if(x[2] == 0){
- k = 1;
- break;
- } } }
- break;
- case 3:
- if((x[0] >= 48) && (x[0] <= 57)){
- if((x[1] >= 48) && (x[1] <= 57)){
- if((x[2] >= 48) && (x[2] <= 57)){
- if(x[3] == 0){
- k = 1;
- break;
- } } } }
- break;
- case 4:
- if((x[0] >= 48) && (x[0] <= 57)){
- if((x[1] >= 48) && (x[1] <= 57)){
- if((x[2] >= 48) && (x[2] <= 57)){
- if((x[3] >= 48) && (x[3] <= 57)){
- if(x[4] == 0){
- k = 1;
- break;
- } } } } }
- break;
- case 5:
- if((x[0] >= 48) && (x[0] <= 57)){
- if((x[1] >= 48) && (x[1] <= 57)){
- if((x[2] >= 48) && (x[2] <= 57)){
- if((x[3] >= 48) && (x[3] <= 57)){
- if((x[4] >= 48) && (x[4] <= 57)){
- if(x[5] == 0){
- k = 1;
- break;
- } } } } } }
- break;
- }
- }
- for(int i = 0; i < b; i++){
- a[i] = x[i] - 48;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement