ad

Thursday, February 20, 2025

C Program to Add Two Integers number

                                        C Program 




1] C Program to Add Two Integers number 

Examples :-

#include<stdio.h>
#include<conio.h>
int  main()
{
int  V, W, sum =0 ;
printf("Enter Two number integer:");
scanf( "%d%d", &V, &W );
sum=V+W;
printf( "sum %d",sum );
getch();
return 0;
}

C Program to Add Two Integers number


Explain Program

Step :1

#include <stdio.h>

 input-output use printf() & scanf() function.

Step :2

int main()

 point of the C program. All execution .

Step :4

  1. int V, W, sum = 0;
  1. Declares three integers: V, W, and initializes sum to 0.

Step :5

  • printf("Enter Two number integer:");
  • Prompts the user.

Step :6

scanf("%d%d", &V, &W);


 two integers from keyboard input and stores them in V and W. %d matches integers and & passes the variable's address so scanf can store values there 

Step :7

sum = V + W;
Adds the twos values and assigns the result to sum

Step :8

printf("sum %d", sum);

Displays the sum. Typically, you'd write printf("sum = %d", sum); to improve readability

Step :9

  • return 0;
  • completed successfully.

1] C Program to Add Two Integers number 

Output 

 Enter Two number integer :

    5
    5
  Sum =10


Related Post :-


No comments:

Post a Comment