Exforsys
+ Reply to Thread
Results 1 to 2 of 2

Help needed on dealinn with While LOOP

This is a discussion on Help needed on dealinn with While LOOP within the C and C++ forums, part of the Programming Talk category; Hello Friends, I need help in writing C program. i am using the same logic for my small project in ...

  1. #1
    summercool is offline Junior Member Array
    Join Date
    Apr 2008
    Answers
    1

    Help needed on dealinn with While LOOP

    Hello Friends,
    I need help in writing C program.
    i am using the same logic for my small project in microcontrollers.

    I am initially sending a value of 'b'.
    But when i am in while loop i calculate a new value 'bbb' and then i need to pass this value to 'b' to calculate the sum.

    I am not sure if this works but please tell me how do i pass values wfrom a while loop to the beginning of the main function.
    I appreciate for your help.

    I am writing my program here

    main()
    {
    int a,b,c;
    int count;
    int sum;
    int bbb;

    a =2; c=12;
    count =0;

    start:
    if (count ==0)
    {
    b = 4;
    }
    else
    {
    b = bbb;
    }

    sum = a+b;

    while(1)
    {
    bbb = 10+c;

    count +=1;

    if (count==1)
    {
    goto start;
    }
    else if(count>1)
    {
    goto here;
    }
    here:
    printf("sum = %d",sum)
    }


    }


  2. #2
    arun17 is offline Junior Member Array
    Join Date
    Oct 2010
    Answers
    6

    solution

    u cannot assume the alphabets directly to integer variable.
    try to initialize them through the character variables


Latest Article

Network Security Risk Assessment and Measurement

Read More...