Subtraction of two number & using ‘scanf’ in C language…

Differences of two number for beginners with basic..

Subtraction of two number for beginners with basic.

According to mathematics….

If a=50 and b=20 then differences = a-b so, 50-20 then answer is ’30’

In this programme initially  you can take number before run. example a=10, b=20,. This programme is only for basic and for beginners.

Some important symbols used in code.

  • () small bracket
  • && use for ‘and’ use for address
  • {} curly bracket
  • “” double code
  1. #include<stdio.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. int a, b, c;
  6. clrscr();
  7. printf(“The difference of two number\n”)
  8. a=100;
  9. b=25;
  10. c=a-b;
  11. printf(“n1 %d – n2 %d = %d”, a, b, c);
  12. getch();
  13. }

Inputs..

If a=100 and b=25 then.

Results..

Subraction = ’75’

Differences of two number by using ‘scanf‘…

  1. #include<stdio.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. int a, b, c;
  6. clrscr();
  7. printf(“Enter two number to find differences of two number\n”)
  8. scanf(“%d%d”, &a, &b);
  9. c=a-b;
  10. printf(“n1 %d – n2 %d = %d”, a, b, c);
  11. getch();
  12. }

Inputs..

If a=100 and b= 25..

Results..

Subraction = ’75’..

Design a site like this with WordPress.com
Get started