Professional Documents
Culture Documents
ASSIGNMENT NO
ROLL NO: 12020
PR NO: 22010343
NAME: Nayan Chandak
AIM(PROBLEM STATEMENT): A)Implement code for addition of two number?
THEORY:
Step 1: Start
Step 7: Stop
2. FLOWCHART
Start
Int num1,num2,sum
Read num1,num2
Sum=num1+num2
Display Result
Stop
3. CODE
#include <stdio.h>
int main()
int num1,num2,sum;
scanf("%d %d",&num1,&num2);
sum=num1+num2;
return 0;
4. OUTPUT
5. CONCLUSION:
From these we can understand how to use basic operator, how complier work , concept of flowchart
and algorithm.
B) Implement program for Prime number.
1. ALGORITHM
Step 1 :Start
Step 3: Divide the number n with (2, n-1) or (2, n/2) or (2, sqrt(n))
Step 4: if the number n is divisible by any number between (2, n-1) or (2, n/2) or (2, sqrt(n)) then it is not
prime
Step 5: If it is not divisible by any number between (2, n-1) or (2, n/2) or (2, sqrt(n)) then it is a prime number
Step 6:Stop
.2.FLOWCHART
●
3. CODE
#include <stdio.h>
int main() {
int n, i, flag = 0;
scanf("%d", &n);
if (n % i == 0) {
flag = 1;
break;
if (n == 1) {
else {
if (flag == 0)
else
return 0;
4. OUTPUT
5. CONCLUSION:
From these we can understand how to use basic operator, how to use for loop and how to break the
loop, how complier work, concept of flowchart and algorithm.