0

Q. – Write a C program to find the subtraction of given two numbers.

Ans:- Two numbers, says a and b, are given (input) and the result sub = a-b of two numbers are to be calculated.




/* Arithmetic Operators Subtraction */
#include <stdio.h>
main()
{
    int a, b, sub;
    scanf("%d %d", &a, &b);
    sub = a-b;
    printf("%d", sub);
    return 0;

}

User Friendly Program



/* Arithmetic Operators Subtraction – User friendly program */
#include<stdio.h>
main()
{
    int a, b, sub;
    printf("\n Enter Value to A: ");
    scanf("%d", &a);
    printf("\n Enter Value to B: ");
    scanf("%d", &b);
    sub = a-b;
    printf("\n Subtract = %d", sub);
    return 0;

}




Like it ? Share it.

Post a Comment

Comment Rules :
1. Do not post Adult/illegal Links.
2. Try to comment in only English Language.
3. Do not post other website's links which are useless.
4. Your Comment should be based on the Topic for other queries Kindly Visit our Contact Us Page.
5. Do not use Abusive Language.
6. Respect each other.
Thank You for following the rules. Please Comment....

 
Top