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);                                       ...

How to Make Calculator by using "switch case" in c language.

How to Make Calculator
 In c language we can make small calculator by using " Switch case".
Switch case is more understanding as compared to" if......else " case, it is also minimize the block of code and easy to use any where.
Let's Understand.


#include <stdio.h>
int main()
{
//operator like (+,-,*,/) using in switch case :  
    char choice;
    double a, b,c;
 
   
    printf("Enter the any one operator + , - , * , /:");
    scanf("%c", &choice);
    switch (choice)
    {  
    case '+':
        printf("Enter two number for addition:");
        scanf("%lf%lf", &a, &b);
        c = a + b;
        printf("Addition of two number is %lf\n",c);

        break;
    case '-':
        printf("Enter two number for substraction:");
        scanf("%lf%lf", &a, &b);
        c = a - b;
        printf("Substraction of two number is %lf\n", c);

        break;
        case '*':
        printf("Enter two number for multiplication:");
        scanf("%lf%lf", &a, &b);
        c = a * b;
        printf("Multiplication of two number is %.2lf\n", c);
        break;
        case '/':
        printf("Enter two number for division:");
        scanf("%lf%lf", &a, &b);
        c =a / b;
        printf("Division of two number is %lf\n", c);
        break;
    default:
        printf("Typing is wrong");
        break;
    }
    return 0;
}



OUTPUT: Enter the any one operator + , - , * , /:+
                  Enter two number for addition:12
                  23
                  Addition of two number is 35.000000

Click here:








Comments

Popular posts from this blog

Selection sort (code & Algorithm)

Multiplication of two number by using C Programs

Addition of two Number using c language code