🔒 Closed Turbo C - Draw pattern using turbo c

Status
Not open for further replies.

negro_lans

Eternal Poster
baka po may nakakaalm kung panu sya pa draw ? ung kalahati lang kc ang na draw ko ...

need to draw :

mahirap.webp

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 ..
 
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.

About this Thread

  • 11
    Replies
  • 743
    Views
  • 6
    Participants
Last reply from:
aa1012

Trending Topics

Online now

Members online
1,047
Guests online
7,087
Total visitors
8,134

Forum statistics

Threads
2,354,212
Posts
29,382,706
Members
1,079,373
Latest member
juanega05
Back
Top