Hi ive been experimenting with basic calculations and using scanf to be able to enter an integer, if i give numb_1 a value it will divide and calculate the remainder fine but i cant get it to work by being able to enter a number, it just sits on the command screen doing nothing.
Sorry for the noobish question im probably doing something clumsy but ive searched quite awhile and can't figure it out!

#include "stdafx.h"

#include <stdio.h>

int main ()
    int numb_1, numb_2 = 5, result,remainder;  

    //ask user to enter integer
	printf ("Please enter number to be divided by 5:\n");

        result = numb_1 / numb_2;              
        remainder = numb_1 % numb_2;  

	//produce output
    printf ("Divided by 5 is %d with remainder %d\n\n", result,remainder); 

Used code tags on first post.
Good first post.

Remove the "\n" from line 13. It worked for me this way.
\n sends output to the next line. When you are scanning input, you don't need to go to a new line.

By the way, next time you have a C question dont post it in the C++ forum. We have a forum dedicated to C. Thanks.

Edited 7 Years Ago by Grn Xtrm: n/a

As simple as that.. cheers for pointing that out.
Apologies on posting in the wrong section also, i noticed after post but couldnt find a way to delete it, wont happen again :)

This question has already been answered. Start a new discussion instead.