Advertisement
Guest User

zadaca2

a guest
Nov 28th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. //zadatak 1
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6. int j(0), i(0);
  7. for(j = 0; j>DANI; j++)
  8. {
  9. if(M[i][j] == vr) raz++;
  10. else
  11. for( ; ; )
  12. {
  13. koji = razred( raz );
  14. if (koji<0) break;
  15. Raz[koji][vr]++;
  16. raz *= 2;
  17. }
  18. }
  19.  
  20. return 0;
  21. }
  22.  
  23. //zadatak 2
  24. /*imas 2 ugnjezdene naredbe grananja (while)
  25. prvi while ima jednu naredbu granjanja if, else
  26. drugi while ima naredbu pridruzivanja, dvije računske operacije
  27. i naredbu grananja
  28. */
  29.  
  30. //zad 3
  31. //sramota ak ovo ne znate
  32. #include <stdio.h>
  33. #include <math.h>
  34. #include <iostream>
  35. using namespace std;
  36.  
  37. int main()
  38. {
  39. int a, b, c;
  40. scanf("%d %d %d", &a, &b, &c);
  41.  
  42. int x;
  43. for(x = -10; x<=10; x++)
  44. {
  45. float y = a*pow(x,2)+ b*x + c;
  46. printf("y(%d) = %.f \n ", x, y);
  47. }
  48.  
  49. system("pause");
  50. return 0;
  51. }
  52.  
  53. //zad 4
  54. #include <stdio.h>
  55. #include <iostream>
  56.  
  57. int main()
  58. {
  59. int i, j, znamenke[5];
  60.  
  61. for(i = 10000; i<99999; i++)
  62. {
  63. j = i;
  64. int n = 4;
  65. while( j > 0 )
  66. {
  67. znamenke[n] = j % 10;
  68. j /= 10;
  69. n--;
  70. }
  71. int zbroj = 0;
  72. for(j = 0; j<5; j++)
  73. {
  74. zbroj += znamenke[j]; }
  75.  
  76. if(zbroj == 29 && znamenke[0] == znamenke[4])
  77. {
  78. printf("%d \n", i);
  79. }
  80. }
  81.  
  82. system("pause");
  83. return 0;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement