Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
1. Write a program that accepts two numbers from the keyboard and prints the following information.

Variables
first
second
Output
First number? 7
Second number? 2
The second number goes into first Q times
with a remainder of 1.
The quotient is 3

C#
#include <stdio.h>
int main(void)
{
   int first;
    int second;
    int result;
    int quotient;
    printf("First number?\n");
    scanf("%d",&first);
    printf("Second number?\n");
    scanf("%d",&second);
    result = first / second;
    quotient = first%second;
    printf("The second number goes into first %d\ntimes with a remainder of %d\n");
    printf("The quotient is %d\n");
    return 0;
}


may i know any place wrong? it cant show out the correct result.
Posted
Updated 17-Feb-11 2:06am
v2

1 solution

Man!:cool:

I love your question. You didn't print the values, so how will it show :laugh:

Last two lines of your code have the solution to your problem (but I will tell you the answer, only if you give me 5 ;P !!)

here you go:

C
printf("The second number goes into first %d\ntimes with a remainder of %d\n", first, quotient);
printf("The quotient is %d\n", result);


and you are done.
 
Share this answer
 
v4
Comments
Jayfam 17-Feb-11 8:11am    
haha, thx thx give u 5 ;P
im now introduction to programming..newbie..sorry ya :-D
Wild-Programmer 17-Feb-11 8:13am    
where's my 5 man :( My voting meter is still 0
Jayfam 17-Feb-11 8:44am    
haha..kk...giv u 5 too^^
Аslam Iqbal 17-Feb-11 9:04am    
Whats now Amit? after my 5
Wild-Programmer 17-Feb-11 12:00pm    
Yes Aslam bhai, now my voting meter looks good :D
Million thanks for the 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900