Skip to main content

Posts

Showing posts from 2016

Armstrong Number

            An Armstrong number is an  n -digit number that is equal to the sum of the  n th  powers of its digits. For example 153 is an Armstrong Number in 3 digit number 1 3  +  5 3  +  3 3   =  153 1  +125+27  =153 1634 is an Armstrong Number in 4 digit number 1 4  + 6 4  + 3 4  + 4 4  =  1634 1+1296+81+256=1634 And so numbers from 0-9 all are Armstrong Numbers as  0 1 is 0 , 1 1   is 1,   2 1 is 2 , 3 1 is 3 and so on..   Armstrong Algorithm Step1: Read a number.  Step2:  Store all the digits of a number in an array digits[] Step3:  Count all the digits of a number and store in variable   length Step4:  Start a loop till  the length of a number Step5: Raise each digit to a power equal to the number of digits in the number. For ex, each digit of a thre...

Multiplication Tables

                        Learn the Multiplication Tables                                                                                 Learn how to write the Program in C to generate the Multiplication Table of any number. Click here to watch on YouTube Learn how to  make  the Multiplication Table App in          MIT App Inventor Click here to watch on YouTube Download the Multiplication Table Android App here Multiplication Table App

Reverse Fibonacci Sequence

Fibonacci sequence works well below zero too. Here is the sequence -8,5,-3,2,-1,1,0,1,1,2,3,5,8,13,… T he sequence below zero has the same numbers as the sequence above zero,  except they follow a +-+- ... pattern. To see the working of Reverse Fibonacci Sequence Flowchart,                                     Click here to watch on YouTube To write the program in C,                            Click here to Watch on YouTube

Factorial of a Number

       FACTORIAL   !   The factorial of a positive integer n , denoted by n! , is the product of all positive integers less than or equal to 1.     For example the factorial of 6 is 6! = 6*5*4*3*2*1 = 720 The value of 0! is 1 , according to the convention for an empty product. We can calculate a factorial of a number(n)  from the previous one i.e. by multiplying the number (n)  to a factorial of number(n-1) . n! = n * (n-1)! For example: 5! = 5*4*3*2*1 = 120 . So calculate the factorial of 6 by above rule. 6! = 6 * (6-1)! = 6 * 5!= 6 * 120 = 720 7! = 7 * (7-1)! = 7 * 6!= 7 * 720 = 5040 To see the working of flowchart,  Click here to watch on YouTube To write the program in C,  Click here to watch on YouTube To Create the Factorial App in MIT App Inventor  Click here to watch on YouTube Download the Factorial Android App here Factorial Android Ap...

Sum of Digits of a Number

Write an algorithm ,a program and  draw a flowchart  to calculate the  sum of digits of any number given by a user. Step1: Read a number (n) to calculate its sum of digits Step2: Divide the value of n by 10 and assign it to variable x Step3: Multiply the value of x by 10 and assign it to variable t Step4: Subtract the value of t by value of n and assign it to variable c Step5: Add the value of c & value of sum and assign it to variable sum Step6: Assign the value of x to variable n Step7: if x is not equal to zero then go back to step2 Step8: Display “the sum is “, value of variable sum Step9: Stop Flowchart To see the working of Algorithm an flowchart,  Click here to Watch on YouTube To write the program in C,  Click here to watch on YouTube To create the SumOfDigits App in MIT App Inventor,  Click here to Watch on YouTube Download the SumOfDigits Android App by clicking below-: ...

Greatest Common Divisor

                       The greatest common divisor (GCD) of two positive  integers  is the largest positive integer that divides the numbers without a remainder. For example the GCD of 24 & 40 is 8 The Greatest Common Divisor (GCD) of two whole numbers also called the  Greatest Common Factor (GCF)   & the Highest Common Factor (HCF). There is a simple & systematic way of finding the GCD of two positive integers. That method is called “Euclid’s Algorithm”.   This algorithm finds GCD by performing  repeated divisions starting from the two numbers we want to find the GCD of until we get a remainder of 0. •Divide the larger number by the smaller one and get the remainder •If remainder is not zero, we divide the smaller number by the      remainder from the last division •Repeat the above step until we get the remainder as zero •The last divisor or number we used to d...

Prime Numbers

Prime Number is a natural number greater than 1 that has exactly two distinct natural number divisors: 1 and itself. A natural number greater than 1 that is not a prime number is called a composite number. For example, 13 can only be divided by 1 and  by 13 itself. Here is a list of all the prime numbers up to 100: 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47, 53,59,61,67,71,73,79,83,89,97,.. 1 is not a prime number as in definition “For a number to be prime it must have two  d istinct (different) factors. Algorithm Step1: Input the number(n) to check for prime number Step2: If n is below or equal to 1  then go to step 12 Step3: if n is equal to 2 then go to step 11 Step4: Assign variable count =n / 2 Step5: Assign variable a=1 Step6: Add 1 to a and store it to variable a Step7: remainder = n % a Step8: if remainder=0 then go to step 12 Step9: subtract one from count and store it to variable count Step10: if count is not equal to 0 then go to s...

Fibonacci Sequence Flowchart

Fibonacci Sequence Flowchart In the previous video of Fibonacci sequence ,we learned about the Fibonacci series and how to write an algorithm. In this video we will learn how to draw a flowchart for it. First let us write an algorithm for it again. 0,1,1,2,3,5,8,13,21,34,55,89,… Step1: Input the number(n) till which the Fibonacci series will run Step2: Assign the variables a equal to -1 and b equal to 1 Step3: Add the variables a & b and assign it to variable x Step4: Display the value of x Step5: Assign the value of b to variable a Step6: Assign the value of x to variable b Step7: Subtract one from n and store it to variable n Step8: If the value of n is not zero, go back to the Step3 Step9: Fibonacci numbers displayed till n numbers. To see the working of above flowchart,  Click here to Watch on YouTube To write the program in C,   Click here to Watch on YouTube To make the Fibonacci Sequence  And...

Fibonacci Sequence

                            A Fibonacci sequence is a series of numbers that starts with a zero, followed by a one, and proceeds based on the rule that each number(called a Fibonacci number) is equal to the sum of the preceding two numbers. 0,1,1,2,3,5,8,13,21,34,… •It starts with 0 & 1. •The next number 1 is found by adding the two numbers before it(1+0). •Similarly, the number 21 is found by adding the two numbers before it(13+8). •And the number 34 from (21+13). •And so on… Here is the list 0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597, 2584,4181,6765,10946,17711,28657,46368,75025,121393, 196418,317811,.... Step1 :Input the number (n) till which the Fibonacci series will run Step2 :Let assign a variable a equal to -1 and b equal to 1 Step3 :We add variable a & b and assign it to variable x Step4 :Display the value of x Step5: Assign the value of b to va...

Flowchart

What is a flowchart?                      A flowchart is a diagrammatic representation of boxes of various kinds  that are connected by arrows to solve a particular problem.                       A flowchart is a type of diagram that  r epresents an algorithm, workflow or process.It is used in analysing,  designing, d ocumenting or managing a process in  v arious fields. Flowcharts have become a popular means for  d escribing computer algorithms. Why use a flowchart?                 It is more effective to  visualise  something graphically  t han it is to describe it with words. Flowchart explain  a process more clearly through symbols and text. To see the working of the above flowchart watch video Click here to Watch on YouTube ...

Algorithm

What is an algorithm? Algorithm is a set of simple steps written to solve a particular task. There can be many task from waking up to going to school, logging on to a gmail account or finding prime numbers etc. For example write an algorithm for logging onto gmail account and checking your mails. STEP1:Open a browser in your desktop/laptop STEP2:Write gmail address www.gmail.com on address bar url of browser. STEP3:Login onto your gmail account with your username and password STEP4:Check your mails if your username and password is correct STEP5:After doing your work on gmail account, logout. Algorithm is a step-by-step list of directions that need to be followed to solve a problem. A recipe can be considered as a type of algorithm.It tells what ingredients are needed to make the dish and what steps to follow.There can be many different recipes to make a certain dish which looks different but ends up tasting the same when all is said and done. The sam...