Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1)
- let a=parseInt(prompt("Podaj liczbę"));
- if (a<0){
- document.write("Nie ma silni z minusa")
- } else if (a===0){
- document.write("Silnia wynosi 1")
- } else {
- silnia=1
- for(let i=a; i>=1; i--){
- silnia*=i;
- }
- document.write("Silnia z "+a+" wynosi "+silnia);
- }
- 2)
- for (let i=99; i>=10; i--){
- if (i%4===0){
- document.write(i+"<br>");
- }
- }
- 3)
- let k=parseInt(prompt("podaj krok"));
- for(let i=0; i<=200; i=i+k){
- document.write(i+" ");
- }
- 5)
- let a;
- let min = 0;
- let max = 0;
- do{
- a=parseInt(prompt('podaj liczbe'));
- if (a>max){
- max=a;
- }
- if (a<min){
- min=a;
- }
- }
- while(a!=0);
- document.write('Najmniejszą liczbą było: '+min+' a największą był: '+max);
- 6)
- let a;
- let suma=0;
- let i=0;
- do{
- i++;
- a=parseInt(prompt('Podaj liczbe'));
- suma=+suma+ +a;
- }
- while(suma!=50);
- document.write('podanych liczb było: '+i);
- 7)
- let suma = 0;
- let a = 2;
- for(let i = 0; i < 30; i++){
- suma += a;
- a *= 2;
- }
- document.write("Syn zaoszczędził: " + suma + " zł");
- 8)
- let suma=0;
- for(let i=10; i>0; i--){
- suma+=i*i;
- }
- document.write('Ilosc cegiel w piramidzie 10x10 to: '+suma);
Advertisement
Add Comment
Please, Sign In to add comment