Advertisement
LegoDrifter

Untitled

Jan 21st, 2021
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. int main()
  7. {
  8. FILE *fPointer;
  9.  
  10. if((fPointer=fopen("text.txt","r"))==NULL)
  11. {
  12. printf("Datotekata ne moze da se otvori.");
  13. return -1;
  14. }
  15. char c,niza[1000];
  16. int brojac1=0,brojac2=0;
  17. while((c=fgetc(fPointer))!=EOF)
  18. {
  19. if(isupper(c))
  20. {
  21. brojac1++;
  22. }
  23. if(islower(c))
  24. {
  25. brojac2++;
  26. }
  27. }
  28. printf("%.4f\n%.4f",(float)brojac1/(brojac1+brojac2),(float)brojac2/(brojac1+brojac2));
  29.  
  30. return 0;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement