Results 1 to 15 of 15

Thread: tugas baprog

+ Reply to Thread
http://idgs.in/324758
  1. #1
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default 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
    Last edited by andrew_sheva; 22-09-10 at 10:40.

  2. Hot Ad
  3. #2
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default

    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;
    }
    }

  4. #3
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default

    #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
    Last edited by andrew_sheva; 05-10-10 at 23:43.

  5. #4
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default

    #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

  6. #5
    Mello's Avatar
    Join Date
    Feb 2009
    Location
    Jakarta/Depok
    Posts
    11,007
    Points
    15,295.39
    Thanks: 164 / 188 / 154

    Default

    ewkoakeowakewao makan tuh codingan
    Everlasting Memories project


    When Tsundere's being honest to you, it means she desperately in love with you and that time too she give you her heart, faith, & trust 100%

  7. #6
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default

    #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
    Last edited by andrew_sheva; 05-10-10 at 23:56.

  8. #7
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default

    tae...gw teknik sipil ada ginian

  9. #8
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default

    #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
    Last edited by andrew_sheva; 05-10-10 at 23:59.

  10. #9
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default

    #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;
    }
    }

  11. #10
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default

    #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

  12. #11
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default

    #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

  13. #12
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default

    #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;
    }

  14. #13
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default

    #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();
    }

  15. #14
    xdalzJr's Avatar
    Join Date
    May 2010
    Posts
    930
    Points
    437.16
    Thanks: 10 / 33 / 25

    Default

    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[]);
    Me Guzta !

  16. #15
    andrew_sheva's Avatar
    Join Date
    Nov 2007
    Location
    Solo-Surabaya
    Posts
    11,330
    Points
    1,524.83
    Thanks: 44 / 73 / 63

    Default

    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;
    		}
    }

+ Reply to Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may post attachments
  • You may edit your posts
  •