-
tugas baprog
#include<iostream>
using namespace std;
void main()
{
int bil, jum, i;
cout<<"Masukkan bilangan: ";
cin>>bil;
jum=0;
for(i=1; i<=bil; i++)
if(bil%i==0)
jum++;
if (jum==2)
cout<<"Bilangan tersebut adalah bilangan prima"<<endl;
else
cout<<"Bilangan Tersebut Bukan bilangan prima"<<endl;
}
prima
-
fibonansi
#include <iostream>
using namespace std;
void main()
{
int x=1,y=1,p,i,a;
cout<<"Masukkan batas deret fibonacci : ";
cin>>a;
cout<<x<<" ";
cout<<y<<" ";
for(i=0;i<=a-3;i++)
{
p=x+y;
cout<<p<<" ";
x=y;
y=p;
}
}
-
#include <iostream>
using namespace std;
void main()
{
int a,b,n;
cout<<"masukkan angka: ";
cin>>n;
for(a=n;a>=1;a--)
{
for(b=1;b<=a;b++)
{
cout<<b;
}
b=a-1;
for(b=b;b>=1;b--)
{
cout<<b;
}
cout<<endl;
}
}
123454321
-
#include<iostream>
using namespace std;
void main()
{
int n,a,b;
cin>>n;
for(a=1;a<=n;a++)
{
for(b=n;b>=a;b--)
cout<<a;
cout<<endl;
}
}
1111
222
33
4
#include<iostream>
using namespace std;
void main()
{
int n,a,b;
char c='a';
cin>>n;
for(a=1;a<=n;a++)
{
for(b=n;b>=a;b--)
{
cout<<c;
}
c=c++;
cout<<endl;
}
}
aaaaa
bbbb
ccc
dd
e
-
ewkoakeowakewao makan tuh codingan :llaugh:
-
#include<iostream>
using namespace std;
void main()
{
int n,a,b;
char c='a';
cin>>n;
for(a=1;a<=n;a++)
{
for(b=1;b<=n;b++)
if ((a==1)||(a==n))
cout<<"*";
else if ((b==1)||(b==n))
cout<<"*";
else
cout<<" ";
cout<<endl;
}
}
kotak
-
tae...gw teknik sipil ada ginian
-
#include<iostream.h>
void main()
{
int n,a,b;
char c='A';
cin>>n;
for(a=1;a<=n;a++)
{
for(b=n;b>=a;b--)
cout<<" ";
for(b=1;b<=2*a-1;b++)
if(b>=a)
{
cout<<c;
c++;
}
else
{
cout<<c;
c--;
}
cout<<endl;
}
}
a
bab
cbabc dst
-
#include<iostream.h>
void main()
{
int a,b,n;
char c;
c='A';
cout<<"masukkan angka: ";
cin>>n;
for(a=1;a<=n;a++)
{
for( b=n;b>=a;b--)
cout<<" ";
for( b=1;b<=a;b++)
{
cout<<b;
}
b=a-1;
for( b=b;b>=1;b--)
{
cout<<b;
}
cout<<endl;
}
}
-
#include<iostream>
using namespace std;
void main()
{
int a[3][3],d[3][3],e,f,g;
cout<<"Inputan Matriks A"<<endl;
for(e=0;e<=2;e++)
for(f=0;f<=2;f++)
{
cout<<"Baris ke-"<<e+1<<"kolom ke-"<<f+1<<"=";
cin>>a[e][f];
}
cout<<"Inputan Matriks B"<<endl;
for(e=0;e<=2;e++)
for(f=0;f<=2;f++)
{
cout<<"Baris ke-"<<e+1<<"kolom ke-"<<f+1<<"=";
cin>>d[e][f];
}
for(e=0;e<=2;e++)
for(f=0;f<=2;f++)
cout<<"\nMenampilkan Matriks C"<<endl;
for(e=0;e<=2;e++)
{
cout<<"|\t";
for(f=0;f<=2;f++)
cout<<a[e][f]+d[e][f]<<"\t";cout<<"|"<<endl;
}
cout<<"Matriks c"<<endl;
}
matriks jumlah
-
#include<iostream>
using namespace std;
void main()
{
int a[3][3],d[3][3],e,f,g;
cout<<"Inputan Matriks A"<<endl;
for(e=0;e<=2;e++)
for(f=0;f<=2;f++)
{
cout<<"Baris ke-"<<e+1<<"kolom ke-"<<f+1<<"=";
cin>>a[e][f];
}
cout<<"Inputan Matriks B"<<endl;
for(e=0;e<=2;e++)
for(f=0;f<=2;f++)
{
cout<<"Baris ke-"<<e+1<<"kolom ke-"<<f+1<<"=";
cin>>d[e][f];
}
for(e=0;e<=2;e++)
for(f=0;f<=2;f++)
cout<<"\nMenampilkan Matriks C"<<endl;
for(e=0;e<=2;e++)
{
cout<<"|\t";
for(f=0;f<=2;f++)
cout<<a[e][f]+d[e][f]<<"\t";cout<<"|"<<endl;
}
cout<<"Matriks c"<<endl;
}
matriks jumlah
-
#include<iostream>
using namespace std;
void swap (int x, int y);
void main()
{
int x=5,y=10;
cout<<"Main before swap , X="<<x<<" , Y= "<<y<<endl;
swap(x,y);
cout<<"Main after swap , X= "<<x<<" , Y= "<<y<<endl;
}
void swap (int x , int y)
{
int temp;
cout<<"swap before swap , X= "<<x<<" , Y="<<y<<endl;
temp=x;
x=y;
y=temp;
cout<<"swap after swap, X ="<<x<<" , Y="<<y<<endl;
}
-
#include<iostream>
#include<fstream>
void main()
{
ofstream tahun;
tahun.open("KABISAT.TXT");
int a,n;
cout<<"Masukkan tahun = ";
cin>>n;
a=n%4;
if(a==0)
tahun<<"ya , ini kabisat";
else if(a==1)
tahun<<"3 tahun lagi";
else if(a==2)
tahun<<"2 tahun lagi";
else if(a==3)
tahun<<"1 tahun lagi";
tahun.close();
}
-
permisiii
seharusnya pke [CODE] tuh
nitip include server GTA SAMP ya
Code:
#if defined _zcmd_included
#endinput
#endif
#define _zcmd_included
#define MAX_FUNC_NAME (32)
#define COMMAND:%1(%2) \
forward cmd_%1(%2); \
public cmd_%1(%2)
#define CMD:%1(%2) \
COMMAND:%1(%2)
#define command(%1,%2,%3) \
COMMAND:%1(%2, %3)
#define cmd(%1,%2,%3) \
COMMAND:%1(%2, %3)
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
forward OnPlayerCommandReceived(playerid, cmdtext[]);
forward OnPlayerCommandPerformed(playerid, cmdtext[], success);
static
bool:zcmd_g_HasOPCS = false,
bool:zcmd_g_HasOPCE = false;
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
zcmd_g_HasOPCS = funcidx("OnPlayerCommandReceived") != -1;
zcmd_g_HasOPCE = funcidx("OnPlayerCommandPerformed") != -1;
return CallLocalFunction("zcmd_OnFilterScriptInit", "");
}
#if defined _ALS_OnFilterScriptInit
#undef OnFilterScriptInit
#else
#define _ALS_OnFilterScriptInit
#endif
#define OnFilterScriptInit zcmd_OnFilterScriptInit
forward zcmd_OnFilterScriptInit();
#else /*not a filterscript*/
public OnGameModeInit()
{
zcmd_g_HasOPCS = funcidx("OnPlayerCommandReceived") != -1;
zcmd_g_HasOPCE = funcidx("OnPlayerCommandPerformed") != -1;
if (funcidx("zcmd_OnGameModeInit") != -1)
{
return CallLocalFunction("zcmd_OnGameModeInit", "");
}
return 1;
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit zcmd_OnGameModeInit
forward zcmd_OnGameModeInit();
#endif /*if defined FILTERSCRIPT*/
public OnPlayerCommandText(playerid, cmdtext[])
{
if (zcmd_g_HasOPCS && !CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))
{
return 1;
}
new
pos,
funcname[MAX_FUNC_NAME];
while (cmdtext[++pos] > ' ')
{
funcname[pos-1] = tolower(cmdtext[pos]);
}
format(funcname, sizeof(funcname), "cmd_%s", funcname);
while (cmdtext[pos] == ' ') pos++;
if (!cmdtext[pos])
{
if (zcmd_g_HasOPCE)
{
return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, "\1"));
}
return CallLocalFunction(funcname, "is", playerid, "\1");
}
if (zcmd_g_HasOPCE)
{
return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, cmdtext[pos]));
}
return CallLocalFunction(funcname, "is", playerid, cmdtext[pos]);
}
#if defined _ALS_OnPlayerCommandText
#undef OnPlayerCommandText
#else
#define _ALS_OnPlayerCommandText
#endif
#define OnPlayerCommandText zcmd_OnPlayerCommandText
forward zcmd_OnPlayerCommandText(playerid, cmdtext[]);
-
Code:
#include<iostream>
using namespace std;
void main()
{
int a,b;
for(a=10;a<=20;a++)
if (a==10)
cout<<" ";
else
cout<<a<<"\t";
for(a=21;a<=30;a++)
{
for(b=10;b<=20;b++)
if(b==10)
cout<<a<<" ";
else
cout<<a*b<<"\t";
cout<<endl;
}
}