0% found this document useful (0 votes)
10 views2 pages

Untitled Document

Uploaded by

24itp029
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Untitled Document

Uploaded by

24itp029
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

RoLL NO: 24ITP015

Name : Kripa vinod patel


COURSE CODE AND NAME: 1CS501 Computer Programming
PRACTICAL NO: 2(a)

Aim: Scan two numbers and display result of different arithmetic operations
(+, -, *, / and %)

Methodology:
#include <stdio.h>

int main() {
int num1, num2;

printf("Enter two integers: ");


scanf("%d %d", &num1, &num2);

printf("Addition: %d + %d = %d\n", num1, num2, num1 + num2);


printf("Subtraction: %d - %d = %d\n", num1, num2, num1 - num2);
printf("Multiplication: %d * %d = %d\n", num1, num2, num1 * num2);

if (num2 != 0) {
printf("Division: %d / %d = %d\n", num1, num2, num1 / num2);
printf("Modulus: %d %% %d = %d\n", num1, num2, num1 % num2);
} else {
printf("Division by zero is not allowed.\n");
printf("Modulus by zero is not allowed.\n");
}

return 0;
}

Output:
Conclusion:use of arithmetic operations.

You might also like