What's new

Closed Turbo C - Draw pattern using turbo c

Status
Not open for further replies.

negro_lans

Eternal Poster
Joined
Jul 30, 2016
Posts
1,067
Reaction
208
Points
334
Age
28
baka po may nakakaalm kung panu sya pa draw ? ung kalahati lang kc ang na draw ko ...

need to draw :

mahirap.png


my output :

oooooo
ooooo
oooo
ooo
oo
o

Eto po ung Code ko :

#include <stdio.h>
#include <conio.h>
int main(){
for(int a=5; a >=1; a--)
{
for(int b=1; b<=a; b++)
{
printf("o");
{
printf("\t");
}
}
printf("\n");
}
getch();
}
--------------------------------------------------------------------

salamat po sa tutulong in advance ..
 

Attachments

Easy:

C:
#include <stdio.h>
#define SIZE 10

int main(void){
    int i=0;
    printf("\nProgram that draws a triangle\n");
    printf("-----------------------------\n\n");
    for(; i<SIZE; i++) {
        for(int x=SIZE; x>i; x--) {
            printf("o");
        }
        for(int z=0; z<i+i; z++) {
            printf("+");
        }

        for(int x=SIZE; x>i; x--) {
            printf("#");
        }
        printf("\n");
    }
    printf("\n");
    return 0;
}

Btw, get away from ancient compiler. Use either GCC, Clang or MSVC.
 
Easy:

C:
#include <stdio.h>
#define SIZE 10

int main(void){
    int i=0;
    printf("\nProgram that draws a triangle\n");
    printf("-----------------------------\n\n");
    for(; i<SIZE; i++) {
        for(int x=SIZE; x>i; x--) {
            printf("o");
        }
        for(int z=0; z<i+i; z++) {
            printf("+");
        }

        for(int x=SIZE; x>i; x--) {
            printf("#");
        }
        printf("\n");
    }
    printf("\n");
    return 0;
}

Btw, get away from ancient compiler. Use either GCC, Clang or MSVC.
Salamat po .. un po kc ang tinuturo ngaun sa school namen .. ako nalang po ang mag coconvert nito .. maraming salamat po ng madame . test ko po
 
You already made the half. All you need to do is to reverse the logic for the other half. Anyways, I have covered the exact problem few months back, you can navigate through the past threads, mas marami pang triangle ang covered dun written in C#. You can easily rewrite it to C++ to comply your language requirement.
 
Status
Not open for further replies.

Similar threads

Back
Top