Skip to content

Instantly share code, notes, and snippets.

@Kkan9ma
Created July 2, 2019 08:34
Show Gist options
  • Save Kkan9ma/ad0366a77aabb71694e9ee233cee0cbc to your computer and use it in GitHub Desktop.
Save Kkan9ma/ad0366a77aabb71694e9ee233cee0cbc to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
</head>
<body>
<script>
var sum = 0;
for(var a = 1; a <= 100; a++){
if(a % 2 === 0){
sum += a;
console.log(a, sum);
}
}
document.write("1에서 100까지 짝수의 합은 " + sum +"입니다.");
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment