Advertisement
Istanvir389

Capital small and digits from a string line input

Oct 9th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. int i,capital=0,small=0,digit=0;
  6. char str[40]="SUit MA QueeN02";
  7. for(i=0; i<strlen(str); i++)
  8. {
  9.  
  10. if(str[i]>='A' && str[i]<='Z')
  11. {
  12.  
  13. capital++;
  14. }
  15. if(str[i]>='a' && str[i]<='z')
  16. {
  17. small++;
  18. }
  19. if(str[i]>='0' && str[i]<='9')
  20. {
  21. digit++;
  22. }
  23. }
  24. printf(" Capitals are in %d",capital);
  25. printf("\nSmalls are in %d",small);
  26. printf("\nDigits are in %d",digit);
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement