Advertisement
simov

DM2 Lab. 1

Mar 6th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.56 KB | None | 0 0
  1. n = Input["Vnesi go n"];
  2. For[i = 1, 3*i < n, i++, If[Mod[i, 2] == 1, Print[i]]]
  3.  
  4. n = Input["n= "];
  5. brojDeliteli = 0;
  6. For[i = 1, i <= n, i++,
  7.  x = Input["broj="];
  8.  Print["Deliteli na ", x, " se: "];
  9.  For[j = 2, j <= x/2, j++,
  10.   If[Mod[x, j] == 0, Print[j]; brojDeliteli++;]]]
  11. Print["Vkupniot broj deliteli na ", n, "-te vneseni broevi e ", \
  12. brojDeliteli]
  13.  
  14. n = Input["Broj na cifri: n= "]
  15. a = Input["Broj: a="]
  16. rez = 0;
  17. tmp = a;
  18. While[tmp > 0, rez += Mod[tmp, 10]^2; tmp = IntegerPart[tmp/10]];
  19. Print["Proizvodot na cifri na brojot ", a, " e: ", rez];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement