ADDING 2 NUMBERS IN C
If you are a beginner then I will suggest you to start creating your programs on a online GDB compiler
To start with C I will suggest you to study from "c by yashwant kanetkar".
HERE IS THE PROGRAM:
//This is my first program
#include<stdio.h>
int main(){
int a,b,z; //declared 3 variables a b and z,
printf("Enter first number \n");
scanf("%d", &a); //scanf is used to take input from user and store it in variable a.
printf("Enter second number \n"); //printf is used to give output to user.
scanf("%d", &b); //input from user stored in variable b.
z=a+b; //'+' is a arithmetic operator in c for adding 2 values
printf("The sum of two numbers is %d \n",z); //%d is used in print statement because we want to give a value from a variable z which is a+b.
return 0;
}
Great content
ReplyDelete