Compare & find differences of two number in C language..

Compare & find differences of two number..

In this programme, comparing of two number which one is ‘LARGER‘ and find the differences of them.

If you enter a=12 OR any number larger compare than b and b=10 then in this equation ‘a‘ is larger. Differences of them is 2.

If you enter a=10 OR any small number compare than b and b=15 then in this is equation ‘b’ is larger. Differences of them is 5.

Some important symbols used in code.

  • () small bracket
  • && use for ‘and’ use for address
  • {} curly bracket
  • “” double code
  • #include<studio.h>
  • #include<conio.h>
  • void main()
  • {
  • int a,, b, c;
  • clrscr();
  • printf(“Enter the number to find differences compare”);
  • scanf(“%d%d”, &a, &b);
  • If(a>b)
  • {
  • printf(“larger number is = %d \n differences is = %d”, a, a-b);
  • }
  • else if(b>a)
  • {
  • printf(“larger number is = %d \n differences is = %d”, b, b-a);
  • }
  • getch();
  • }

Inputs..

If a=12 and b=10 then

Results..

If a= 10 and b= 15 then

Results..

Leave a comment

Design a site like this with WordPress.com
Get started