Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ex1() {
- let n = parseInt(prompt("number of classes: "));
- console.log(n);
- let s1=0, s2=0;
- for(let i=0;i<n;i++){
- let note, coef;
- [note, coef] = prompt(i+1+") note,coef").split(",");
- console.log(i+1+") note,coef: "+note+", "+coef);
- s1 += parseFloat(note)*parseInt(coef);
- s2 += parseInt(coef);
- }
- let average = s1/s2;
- console.log("average: "+average);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement