Code::Blocks Forums

User forums => Help => Topic started by: ntamas on September 18, 2014, 11:32:57 pm

Title: After built and run,the program stopped working...any idea?
Post by: ntamas on September 18, 2014, 11:32:57 pm
so after I clicked on 'build and run',the program starts to work,but after inserting 2 numbers and hitting enter,the program stops working...

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,f,e,c,d;
    printf("Insert two numbers.\n");
    scanf("%d,%d",&a,&b);

    if ((b=0)&&(b=1))
     {

      printf("No solution.\n");
     }
    else
        {
         c=(4*b);
         d=c+7*(2*a-1);
         e=b*(b-1);
         f=d/e;

         printf("x=%d",f);
         scanf("%d",f);

        }

}

any idea?
Title: Re: After built and run,the program stopped working...any idea?
Post by: stahta01 on September 19, 2014, 12:04:36 am
I have the idea that you did NOT read the rules.

http://forums.codeblocks.org/index.php/topic,9996.0.html (http://forums.codeblocks.org/index.php/topic,9996.0.html)

Edit: Your code is broken dividing by zero can cause many this to happen.

Tim S.