Computer Assignment 1.odt
Computer Assignment 1.odt
Technology
Roll no: 16
BscCSIT 2079
1
1. Write an algorithm and flowchart to display Sum of two numbers.
Step1 : Start.
Step2 : Input two number a and b.
Step3 : Sum=a+b;
Step4 : Display sum.
Step5 : End.
1
2. Write an algorithm and flowchart to display if the number is positive or negative.
Step1 : Start
Step2: Input number n.
Step3: If n is less than 0 , display n is negative
Else display n is positive.
Step4: End.
3. Write an algorithm and flowchart to display whether the number is even or odd.
Step1: Start.
Step2: Input number n.
Step3: If n%2==0 then display n is even
Else display n is negative.
Step4: End.
4. Write an algorithm and flowchart to read three numbers and print the greatest number.
Step1: Start.
Step2: Input three numbers a,b and c.
Step3: If a >b & a>c, display a is the greatest number.
Else go to step 4.
Step4: If b>c ,display b is the greatest number.
Else display c is the greatest number.
Step5: End.
5. Write an algorithm and flowchart to find the sum of the series 1+2+3+4..... Up to entered n numbers.
Step1: Start.
Step2: Input number n.
Step3: Initialize i=1, sum =0, If i=<n;
sum =sum +i;
Else go to step 6.
Step4: i=i+1; ,Go to step 3.
Step5: Display sum.
Step6: End.
8. Write an algorithm and flowchart to read a number n and display all of its divisors.
Step1: Start.
Step2: Input number n.
Step3: Initialize i=1, if I<=n go to step 4
Else go to step 6.
Step4: If n%==0 then print “I is divisor”
Else ignore.
Step5: i=i+1, go to step 3.
Step6: End.