use a for loop with a count start with i=1 thn have a MAX value ..
inside loop go on printing count (i) numbers of stars
U will get this

*
**
***
****
....

#include<stdio.h>
main()
{
    char ch;
    int num,currency_type;  
    float amount,Baht,Dollar,Riel;

    MM: 
    printf("Please enter your currency rates:\n");
    printf("Riel=");
    scanf("%f",&Riel);
    printf("Baht=");
    scanf("%f",&Baht);
    printf("Dollar=");
    scanf("%f",&Dollar);
    printf("Please enter your amount you want to convert:");
    scanf("%f",&amount);
    printf("What type of currency you type in 1=Riel    2=Baht    3=USD\n");
    scanf("%d",&currency_type);
    LL:
    printf("4.To Riel\n");
    printf("5.To Dollar\n");
    printf("6.To Baht\n");  
    printf("Enter number to convert:\n");
    scanf("%d",&num);   


    switch(num)
{   
    case 4 : if(currency_type=2)
            {   printf("your money is %.2f\n",(amount*Riel)/Baht);
                printf("Riel rate = %.2f\n",Riel);}

             else if(currency_type=3)
            {   printf("your money is %.2f\n",(amount*float(Riel)));
                printf("Riel rate = %.2f\n",Riel);}

             else if(currency_type=1)
            {   printf("your money is %.2f\n",amount);
                printf("Riel rate = %.2f\n",Riel);}
                               break;
    case 5 : if(currency_type=1)
            {   printf("your money is %.2f\n",amount/Riel);
                printf("Dollar rate = %.2f\n",Dollar);}

             else if(currency_type=2)
            {   printf("your money is %.2f\n",amount/Baht);
                printf("Dollar rate = %.2f\n",Dollar);}

             else if(currency_type=3)
            {   printf("your money is %.2f\n",amount);
                printf("Dollar rate = %.2f\n",Dollar);}
                break;
    case 6 :  if(currency_type=1)
            {   printf("your money is %.2f\n",(amount*Baht)/Riel);
                printf("Baht rate = %.2f\n",Baht);}

             else if(currency_type=3)
            {   printf("your money is %.2f\n",amount*Baht);
                printf("Baht rate = %.2f\n",Baht);}

             else if(currency_type=2)
            {   printf("your money is %.2f\n",amount);
                printf("Baht rate = %.2f\n",Baht);}
                break;
    default : printf("Invalid number!\n");   goto LL;

                }

    printf("Do you want to continue?(y/n)\n");
    scanf("%s",&ch);    
    if(ch=='y'||ch=='Y') goto MM;








}

can anyone help me with this . the syntax of the code is ok.but the thing dat i don understand is when convert it .the result gone wrong.thx in advance.thx all friend

Edited 3 Years Ago by mike_2000_17: Fixed formatting

#include<stdio.h>
int main()
{
    int i,j,n;
    printf("Please enter the number of lines.\n");
    scanf("%d",&n);
    for(i=1;i<=n;i++){
       for(j=1;j<=i;j++){
        printf("*");
       }
       printf("\n");
    }
    return 0;
}
#include<stdio.h>
int main()
{
    int a,b,n;
    printf("Please enter the number of lines.\n");
    scanf("%d",&n);
    for(a=n;a>0;a--){
        for(b=a;b>0;b--){
            printf("*");
        }
        printf("\n");

    }
    return 0;
}

Edited 5 Years Ago by Ezzaral: n/a

Comments
no note with your code!!!!!!
This article has been dead for over six months. Start a new discussion instead.