Arithmetic Operations in C
Example-1:-
#include <stdio.h>void main()
{ //संख्या x,y को declare कीजिए
//sum को भी declare कीजिए जिसमे x+y को रखा जाएगा
int x,y,sum;
//x और y variables में नंबर रखिए
printf("Enter Two Integers : ");
scanf("%d%d",&x,&y);
//फ़िर,x और y को जोड़िए और sum के कक्ष में रखिए
sum=x+y;
//फ़िर,sum को print करवा लीजिए
printf("\nAddition = %d",sum);
}
/*Enter Two Integers : 4 8
Addition = 12
[Process completed (code 14) - press Enter]*/
Example-2:-
#include<stdio.h>
void main()
{
//int में करके📢declare a,b,c
int a,b,c;
//a variable के अंदर एक अंक🔢लिखता✍️हूं,
printf("Enter first number\n");
//फ़िर, सिस्टम scanf😌के मदद से a variable को पढ़ लेता है
scanf("%d",&a);
//b variable में भी दूजा अंक🔢रखता हूं,
printf("Enter second number\n");
//फ़िर, system वैसे ही दोबारा b variable पढ़ लेता है,
scanf("%d",&b);
//बाद में,c की डोली🧺में a-b को बैठा कर,
c=a-b;
//a-b को c के द्वारा प्रिंट🖨️करवा लेता हूं 😂
printf("Sub=%d",c);
}
/*Enter first number
8 9
Enter second number
Sub=-1
[Process completed (code 6) - press Enter]*/
Comments
Post a Comment