Posts

Showing posts with the label programming

DOUBLE LINKED LIST IMPLEMENTATION

Image
welcome to yocoding, a place where you can find what you need, if not comment what you need.   CODE :  #include<stdio.h> #include<conio.h> #include<stdlib.h> struct Node {   int data;   struct Node *prev,*next; }; struct Node *head=NULL; void insert_beg(int d) {     struct Node *p;     p= (struct Node*)malloc(sizeof(struct Node));     p->data=d;     p->prev=NULL;     if(head == NULL)     {        p->next = NULL;        head=p;     }     else     {        p->next=head;        head->prev=p;        head=p;     } } void insert_end(int d) {    struct Node *p;    p=(struct Node*)malloc(sizeof(struct Node));    p->data=d;    p->next = NULL;    if(head == NULL)    {   ...

swapping first and last digits of a number :Python Program

Image
  Here is the program for swapping first and last digits of a number in Python programming language program code : n=int(input("number:")) last=n%10 n=int(n/10) n1=str(n) n2=str(1) n6=str(1) for i in range(len(n1)-1):     n2=n2+str(0)     n6=n6+str(0) n6=int(n6) n2=int(n2) n5=int(n/n6) n3=n%n2 print(n5) n4=str(last)+str(n3)+str(n5) print(int(n4)) output : enter number :284517 784512 happy coding. comment what you need.