0

hi! i have a program in C++ that produces a right triangle of character and i need the same program, i mean a program that makes the same function, but in C.
This is my program in C++ :

include <iostream>

using namespace std;
int main()

{
    int i,j;

        char input,temp='A';
        cout<<"Enter uppercase character you want in triange at last row: ";
        cin>>input;
        for(i=1;i<=(input-'A'+1);++i)
        {
            for(j=1;j<=i;++j)
               cout<<temp<<" ";
            ++temp;
            cout<<endl;
        }
        return 0;
    }

please help me :)

3
Contributors
2
Replies
21
Views
4 Years
Discussion Span
Last Post by mridul.ahuja
0
{
    int i,j;
        char input,temp='A';
        printf("Enter uppercase character you want in triange at last row: ");
        scanf("%c",&input);
        for(i=1;i<=(input-'A'+1);++i)
        {
            for(j=1;j<=i;++j)
               printf("%c  ",temp);
            ++temp;
            printf("\n");
        }
        return 0;
    }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.