Singly Linked List in C with Code and Explanation

Image
                        Singly LinkedList (SLL)   A Singly Linked List is a linear data structure where each element (called a node ) points to the next node in the sequence.  It is a dynamic structure , meaning it can grow or shrink in size during runtime .  Structure of a Node:  Each node contains: - Data : The value stored in the node. - Next : A pointer / reference to the next node in the list . There are Five operation in SLL: 1) Insert - Insert the element in our node like, insert(34);                                                                            insert(3);                                       ...

Multiplication of two number by using C Programs

Multiplication of two number by using C Programs

 Let's Understand Step by Step:

Algorithm:
  1. Start: Take two numbers, a and b.

  2. Initialize: Set a result variable, result, to 0.

  3. Loop: Iterate until one of the numbers (say b) is 0.

    • If b is odd, add a to result.

    • Double a (i.e., a=a×2).

    • Halve b (i.e., b=b/2).

  4. End: The result now contains the product of a and b.

 
Flow chart:
             
Program for multiplication:
  
#include<stdio.h>

int main()
{
    int a,b,c;

   
printf("enter two number:");
   
scanf("%d %d", &a,&b);
   
c = a * b;
   
printf("multiplication of %d * %d is %d", a,b,c);

return 0;


}

Output:
enter two number:12
12
multiplication of 12 * 12 is 144

Question for you -
  Multiplication of two numbers a=15 and b=9
Solve and comments your Answers in comment box.
see this video:




Comments

Popular posts from this blog

Selection sort (code & Algorithm)

Addition of two Number using c language code