Advertisement
ErolKZ

Untitled

Jul 6th, 2021
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. // For
  2.  
  3. function solve (input) {
  4.  
  5.  
  6. let result = 0;
  7.  
  8.  
  9. for (let i = 1; i <= 100; i++) {
  10.  
  11. if (i % 3 === 0) {
  12.  
  13. result = i;
  14.  
  15. console.log(result);
  16.  
  17. }
  18.  
  19.  
  20. }
  21.  
  22.  
  23.  
  24. //While
  25.  
  26.  
  27.  
  28. function solve (input) {
  29.  
  30.  
  31. let result = 0;
  32.  
  33. let index = 1;
  34.  
  35.  
  36. while (index <= 100) {
  37.  
  38. if (index % 3 === 0) {
  39.  
  40. result = index;
  41.  
  42. console.log(result);
  43.  
  44. }
  45.  
  46.  
  47. index++;
  48.  
  49.  
  50.  
  51. }
  52.  
  53.  
  54.  
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement