Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.21 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5. int main(){
  6.  
  7.  char liczba [2];
  8.  
  9.     do{ printf("Podaj liczbe 10-50:\n");
  10.         scanf("%s",liczba);
  11.         }
  12.  while (liczba[0]<'1' || liczba[1]<'0' || liczba[0]>'4' );
  13.  
  14.  
  15.  
  16.    int numer;
  17.    numer= atoi(liczba);
  18.    printf("Liczba typu int: %d \n",numer);
  19.  
  20.  
  21.     char lan1[numer+1];
  22.     char lan2[numer+1];
  23.  
  24.  
  25.    do{ printf("Podaj  haslo: \n");
  26.    scanf("%s",lan1);
  27.    printf("Powtorz haslo: \n");
  28.    scanf("%s",lan2);
  29.  
  30.    }
  31.    while( strcmp( lan1, lan2 ) > 0 || strcmp( lan1, lan2 ) < 0 );
  32.  
  33.  
  34.  
  35.    int i;
  36.    int k=0;
  37.    int g=0;
  38.    int z=0;
  39.    int s=0;
  40.  
  41.     for(i=0;i<strlen(lan1);i++)
  42.     {
  43.         if (lan1[i]>='A'&&lan1[i]<='Z')
  44.         {
  45.             k+=1;
  46.  
  47.         }
  48.         if(lan1[i]>='a'&&lan1[i]<='z')
  49.         {
  50.             g+=1;
  51.         }
  52.         if (lan1[i]>='0'&&lan1[i]<='9')
  53.         {
  54.             z+=1;
  55.  
  56.         }
  57.          else if (lan1[i]>='!'&&lan1[i]<='/')
  58.         {
  59.             s+=1;
  60.  
  61.         }
  62.  
  63.     }
  64.  
  65.  
  66.  
  67.  
  68.  
  69.   printf("liczbaa duzych liter: %d ",k);
  70.  
  71.   printf("liczbaa malych liter: %d ",g);
  72.  
  73.   printf("liczbaa liczb : %d ",z);
  74.  
  75.   printf("liczbaa ZN.S : %d ",s);
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85. return 0;
  86.  
  87.  
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement