News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

After built and run,the program stopped working...any idea?

Started by ntamas, September 18, 2014, 11:32:57 PM

Previous topic - Next topic

ntamas

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?

stahta01

I have the idea that you did NOT read the rules.

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

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

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]