Print the Quotient and Remainder of two value

What is my problem? please help me to fix this for our assignment ;]

#include <stdio.h>
#include <conio.h>

int a,b;
int resultq,resultr;

void main ()
clrscr ();
printf ("Input the first value : ");
scanf ("%d", &a);
printf ("Input the second value : ");
scanf ("%d",&b);

if(a&&b <= 0){
printf("First and Second value should bea positive value");

resultq = b / a;
resultr = b % a;
printf("The quotient of the first and second value is: ", resultq);
printf("The remainder of the first and second value is: ", resultr);
Last edited on
Should be
if( a<= 0 || b<=0 )

Instead of a&&b <=0

On a related note, why are you computing only for positive values?
Is that part of the problem definition ?

Otherwise just checking if a is not equal to zero should be sufficient.

Topic archived. No new replies allowed.