Hi! i am new to C, so i want your help about a program. Could someone post any code on how to add two fractions, and checking the case of the zero denominator...thanks!
my code is:
Code:
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main()
{
int a, b, c, d;
char dummychar;
int divisor, divident;
printf( "Enter First divisor:");
scanf("%d",&a);
printf("\n");
printf("Enter the First divident:");
scanf("%d",&b);
printf("\n");
printf( "Enter second divisor:");
scanf("%d",&c);
printf("\n");
printf( "Enter second divident:");
scanf("%d",&d);
printf("\n");
divisor = a*d + b*c;
divident = b+d;
how can i print the result..and how can i use an if statement to checking for zero divident?