C Program to find the whether the last digit of given two numbers are equal or not

Description

Get two numbers num1 and num2 and check whether last digit of num1 and num2  are equal or not?.
Input:
65 45
Ouput:
Equal

Input:
35 38
Output:
Not Equal

Solution

#include<stdio.h>
int main()
{
int num1,num2;
printf("Enter two numbers:");
scanf("%d %d"&num1,&num2);
if(num1%10==num2%10)
{
printf("%d and %d are equal",num1%10,num2%10);
}
else
{
printf("%d and %d are not equal",num1%10,num2%10);
}
return 0;
}

Explanation

extract the last digits of num1 and num2 using %10, then compare last digits.

Interesting Pattern Programs: for more Patterns

Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution
Input:
5
Output:
*
***
*****
*******
*********
*******
*****
***
*Solution
Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution
Input:
5
Output:
*********
*******
*****
***
*
***
*****
*******
*********Solution