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); 

Grn Xtrm commented: Good first post. +1
VernonDozier commented: Used code tags on first post. +8
Re: Starting C question 80 80

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.

Re: Starting C question 80 80

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.