Monday, April 13, 2020

Arithmetic operators in C


  • Program :
#include <stdio.h>
#include<conio.h>
void main()
{
    int a,b,c,d,e,f,g;
    clrscr();
    printf("\n----------------ARITHMETIC OPERATORS----------------");
    printf("\nEnter A and B values:");
    scanf("%d%d",&a,&b);
    printf("\n----------------ARITHMETIC OPERATOR(+)----------------");
    c=a+b;
    printf("\nSum is : %d",c);
    printf("\n----------------ARITHMETIC OPERATOR(-)----------------");
    d=a-b;
    printf("\nDifference is : %d",d);
    printf("\n----------------ARITHMETIC OPERATOR(*)----------------");
    e=a*b;
    printf("\nMultiply is : %d",e);
    printf("\n----------------ARITHMETIC OPERATOR(/)----------------");
    f=a/b;
    printf("\nDivision is : %d",f);
    printf("\n----------------ARITHMETIC OPERATORS(%)----------------");
    g=a%b;
    printf("\nModulo is : %d",g);
    getch();
}

  • Output :







No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...