Showing posts with label Operator. Show all posts
Showing posts with label Operator. Show all posts

C Program to Find The Product Of Two Numbers Without Multiplication Operator.

How to write a C Program to find the product of two numbers without Multiplication Operator in C Programming Language ?

Solution for C Program: 

/*C Program to Find The Product Of Two Numbers Without Multiplication Operator.*/
#include<stdio.h>
void main()
{
int x, y, I, sum;
printf("\nEnter any two numbers : ");
scanf("%d%d", &x, &y);
I = 1;
sum = 0;
while(I <= y)
{
sum += x;
I++;
}
printf("\nThe Product of %d and %d is %d.", x, y, sum);
}

You may also learn these C Program/Code :

C Program To Swap Two Numbers Without Using Third Variable

C Program to Rectangular Triangle Using Operator

How to write a c program to Rectangular Triangle using operator in  C Programming Language ?


#include <stdio.h>
#include <stdlib.h>

int isRectangularTriangle (int a, int b, int c)
{
    return ((a>0)&&(b>0)&&(c>0)&&((a*a == b*b + c*c) || (b*b == a*a + c*c) || (c*c == b*b + a*a)));
}

int main()
{
    int A, B, C;
    printf("A=0, B=2, C=8, isRectangularTriangle: %d\n\n", isRectangularTriangle(0, 2, 8));
    printf("A=1, B=-2, C=3, isRectangularTriangle: %d\n\n", isRectangularTriangle(1, -2, 3));
    printf("A=3, B=-4, C=5, isRectangularTriangle: %d\n\n", isRectangularTriangle(3, -4, 5));
    printf("A=3, B=4, C=5, isRectangularTriangle: %d\n\n", isRectangularTriangle(3, 4, 5));

    printf("input A\n");
    scanf("%d", &A);
    printf("input B\n");
    scanf("%d", &B);
    printf("input C\n");
    scanf("%d", &C);
    printf("isRectangularTriangle: %d\n", isRectangularTriangle(A, B, C));
    return 0;
}