WOMBAT HADIAH
/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <stdio.h>
int DAPAT_HADIAH(int jumlah1,int jumlah2)
{
if(jumlah1 % 2 != 0 && jumlah2 % 2 == 0)
{
return 1;
}else
{
return 0;
}
}
int main()
{ int i;
int jumlah1;
jumlah1 = 0;
int jumlah2 = 0;
int arr[9] = {1,2,3,4,5,6,7,8,9};
for(i = 0;i<9;i++)
{
if(arr[i] % 2 == 0)
{
jumlah1 = jumlah1 + arr[i];
}
if(arr[i] % 2 != 0)
{
jumlah2 = jumlah2 + arr[i];
}
}
if(DAPAT_HADIAH(jumlah1,jumlah2) == 1)
{
printf("dpt");
}else
{
printf("engga");
}
return 0;
}
Komentar
Posting Komentar