Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Problem solving few assignments in C language #3237
    bhavin
    Participant

    Q.21 answer:

    #include
    #include
    int convert(float a);
    void main()
    {
    float k;
    clrscr();
    printf("Enter any wieght in KG:");
    scanf("%f",&k);
    convert(k);
    getch();
    }
    int convert(float r)
    {
    int a;
    a=r*1000;
    printf("nGram Value is = %dgrams",a);
    return(0);
    }

    output:
    enter any weight in kg 2

    gram value is = 2000grams

    in reply to: Problem solving few assignments in C language #3236
    bhavin
    Participant

    qution no 20: answer


    #include
    #include
    void main()
    {
    int i,j;
    clrscr();

    for(i=1;i<=5;i++)
    {
    if(i==4)
    i=4+1;
    for(j=1;j<=i;j++)
    {
    printf("*");
    }
    printf("n");
    }
    getch();
    }

    output:
    *
    **
    ***
    *****

    in reply to: Problem solving few assignments in C language #3235
    bhavin
    Participant

    Question 19 answer:

    #include
    #include
    void main(){
    int i,j;clrscr();
    for(i=1;i<=5;i++){
    for(j=1;j<=i;j++){
    printf("*");    
    }    
    printf("n");
    }
    getch();
    }

    output:
    *
    *****
    ****
    *****

Viewing 3 posts - 1 through 3 (of 3 total)