Advertisement
mateod747

Untitled

Jan 18th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. //#include<stdio.h>
  2. //#include<stdlib.h>
  3. //#include<time.h>
  4. //#include<string.h>
  5. //int main(void)
  6. //{
  7. // float polje[200], kopija[101];
  8. // int i;
  9. // srand((unsigned)time(NULL));
  10. // for (i = 0; i < 200; i++)
  11. // {
  12. // polje[i] = -5 + (float)rand() / RAND_MAX * 15;
  13. // printf("%d. %f\n", i + 1, polje[i]);
  14. // }
  15. // puts("\nKopija:");
  16. // memcpy(kopija, polje + 49, 101 * sizeof(float));
  17. // for (i = 0; i <= 100; i++)
  18. // printf("%d. (%d.) %f\n", i+1, i+50, kopija[i]);
  19. // return 0;
  20. //}
  21.  
  22. //#include<stdio.h>
  23. //#include<stdlib.h>
  24. //#include<string.h>
  25. //int main(void)
  26. //{
  27. // char string[16];
  28. // int i, brojac = 0;
  29. // puts("Unesite recenicu do 15 znakova");
  30. // fgets(string, 16, stdin);
  31. // do
  32. // {
  33. // puts("Unesite recenicu 8-15 znakova");
  34. // fgets(string, 16, stdin);
  35. // } while (strlen(string) < 8);
  36. // for (i = 0; string[i] != '\0'; i++)
  37. // {
  38. // switch (tolower(string[i]))
  39. // {
  40. // case 'a':
  41. // case 'e':
  42. // case 'i':
  43. // case 'o':
  44. // case 'u':
  45. // brojac++;
  46. // }
  47. // }
  48. // printf("Recenica ima %d samoglasnika", brojac);
  49. // return 0;
  50. //}
  51.  
  52. //#include<stdio.h>
  53. //#include<math.h>
  54. //double rjesenje(double x1, double x2)
  55. //{
  56. // double y;
  57. // y = exp(x1 * x2) - pow(x1, 3) + pow(x2, 4) + sqrt(pow(x1, 2) + pow(x2, 2));
  58. // return y;
  59. //}
  60. //int main(void)
  61. //{
  62. // double x1, x2, y;
  63. // puts("Unesite vrijednosti varijabli x1 i x2");
  64. // scanf("%lf %lf", &x1, &x2);
  65. // y = rjesenje(x1, x2);
  66. // printf("Rjesenje jednadzbe je: %lf", y);
  67. // return 0;
  68. //}
  69.  
  70. #include<stdio.h>
  71. #include<string.h>
  72. #include<stdlib.h>
  73. int string(char *p)
  74. {
  75. int broj = 0, i;
  76. for (i = 0; p[i] != '\0'; i++)
  77. {
  78. switch (p[i])
  79. {
  80. case '0' :
  81. case '1' :
  82. case '2' :
  83. case '3' :
  84. case '4' :
  85. case '5' :
  86. case '6' :
  87. case '7' :
  88. case '8' :
  89. case '9' :
  90. broj++;
  91. }
  92. }
  93. return broj;
  94. }
  95. int main(void)
  96. {
  97. char p[200];
  98. int broj;
  99. puts("Unesite recenicu");
  100. fgets(p, 200, stdin);
  101. broj = string(p);
  102. printf("Vasa recenica sadrzi %d znamenki", broj);
  103. return 0;
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement