myusufs

kpk

Feb 25th, 2021
560
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <conio.h>
  3. int main(){
  4.     int x,y,i,kpk=0;
  5.     printf("Mencari KPK (Kelipatan Persekutuan Terkecil)\n");
  6.     printf("Masukkan bilangan bulat pertama : "); scanf("%d",&x);
  7.     printf("Masukkan bilangan bulat kedua   : "); scanf("%d",&y);
  8.    
  9.     for(i=1;i<=y;i++){
  10.         kpk+=x;
  11.         if(kpk%y==0){
  12.             printf("\n\nKPK dari %d dan %d adalah %d\n",x,y,kpk);
  13.             break; //berhenti di hasil pertama
  14.         }
  15.     }
  16.     getch();
  17. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×