Monday, 6 July 2015

Write C Program To Perform Airthmetic Operation Addition , Multiplication, Subtraction,Division of two Numbers

Write C Program To Perform Airthmetic Operation Addition , Multiplication, Subtraction,Division of two Numbers
1:  #include <stdio.h>  
2:  int main()  
3:  {  
4:    int first, second, add, subtract, multiply;  
5:    float divide;  
6:    printf("Enter two integers\n");  
7:    scanf("%d%d", &first, &second);  
8:    add = first + second;  
9:    subtract = first - second;  
10:    multiply = first * second;  
11:    divide = first / (float)second;  //typecasting  
12:    printf("Sum = %d",add);  
13:    printf("Difference = %d",subtract);  
14:    printf("Multiplication = %d",multiply);  
15:    printf("Division = %.2f",divide);  
16:    return 0;  
17:  }  

No comments:

Post a Comment