Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to divide two numbers

Posted By: Raimundo Fischer     Category: C Programming     Views: 7637

Write a program to divide two numbers.

Code for Program to divide two numbers in C Programming

#include <stdio.h>

void main()
{


        int number1,number2,number3;
        printf("Enter the first number:");
        if(scanf("%d",&number1)==1)
        {
                printf("Enter the second number:");
                if(scanf("%d",&number2)==1)
                {
                number3=number1/number2;
                printf("The division is =%d",number3);
                }
                else
                {
                        printf("Error,try again.");
                }
        }
        else
        {
                printf("error,enter correct value");
        }
}
[EOB]


=================================OUTPUT======================================


Enter the first number:39
Enter the second number:14
The division is =2
  
Share: 


Didn't find what you were looking for? Find more on Program to divide two numbers Or get search suggestion and latest updates.

Raimundo Fischer
Raimundo Fischer author of Program to divide two numbers is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!