Coder Social home page Coder Social logo

soal-kelipatan's Introduction

Objectives

  • Mengaplikasikan Syntax for

  • Mengaplikasikan Syntax if-else

Directions

  1. Buatlah sebuah perulangan 1 - 100 dengan pertambahan counter sebanyak 1

  2. Di dalam perulangan, periksa setiap angka counter:

    • Apabila angka counter adalah angka genap, tuliskan GENAP

    • Apabila angka counter adalah angka ganjil, tuliskan GANJIL

  3. Buatlah 3 perulangan baru dari 1 - 100, dengan pertambahan counter sebesar 2, 5, dan 9.

  4. Pada 3 perulangan baru ini periksa setiap angka counter:

  • Apabila bukan kelipatan yang ditentukan tidak perlu menuliskan apa-apa

  • Apabila angka counter adalah kelipatan (pertambahan counter + 1), tuliskan:

  • "[counter]" + "KELIPATAN [pertambahan counter + 1]"

Contoh output

//contoh - ganjil genap

//counter sekarang = 1,

//output

"GANJIL"

//counter sekarang = 2,

//output

"GENAP"

// dan seterusnya :)



//contoh - untuk pertambahan counter 2

//counter sekarang = 1,

//output

""

//counter sekarang = 3,

//output

"3 KELIPATAN 3" 
/
/ dan seterusnya :)



//contoh - untuk pertambahan counter 5

//counter sekarang = 1,

//output

""
//counter sekarang = 6,
//output

"6 KELIPATAN 6"
// dan seterusnya :)



//contoh - untuk pertambahan counter 9

//counter sekarang = 1,

//output

""

//counter sekarang = 10,
//output
"10 KELIPATAN 10"

// dan seterusnya :)

soal-kelipatan's People

Contributors

zanisis avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.