Posts

Showing posts with the label C language program

C Program To Insert Element In Singly Linked List ( Insert at last, Insert at beginning and Insert at some position )

Linked List is a sequential data structure in which elements are stored via link. Every node is connect with other node. Generally Linked List are three type: Singly Linked List Doubly Linked List Circular Linked List In this article we will cover how we can insert element in the singly linked list at the different position Singly Linked List In singly linked list data structure there are mainly two part first is link part and second is data part. In the link part of singly linked list the base address of the next node is stored. And in the data part actual data is stored.        1->2->3->4->5->NULL Link part of the last node of the singly linked list contain NULL. Insert Data At Beginning In The Singly Linked List First of all check linked list is empty or not if linked list have no node then make the newNode->NULL and make newNode as a Head node. If linked list have already some nodes then make newNode->next = head and head = newNode. Insert Da...

Program in C Language: Number Is Prime Or Not, Print Name 10 Times

1. Program in C language to check whether the number is Prime or not : # include<stdio h> # include<conio.h> void main() { int n, i, temp; clrscr(); printf ( "Enter any number \n"); scanf("%d ,& n ); temp= n/2; for ( i=2;i<= temp;i++) } if ( n % i= = 0) { printf("% d is not a prime no.",n); break; } } if (i = = temp + 1) { printf ("  % d is a prime number",n); } getch(); } 2. How to print name 10 times in C language #include<stdio.h>            #include<conio.h> void main() { int i; char name[20]; clrscr(); printf("Enter your name"); gets(name); for(i=1;i<=10;i++) { puts(name); } getch(); } How to write a program in C language. . How to apply a loop in C language.