Posts

Showing posts with the label Switch case

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