Posts

Showing posts from March, 2012

tips nd tricks section added soon

Tips nd tricks section added soon. Pls give ur comment nd suggestion to improve this blog.

Program to implement LAPLACE - EVERETT'S INTERPOLATION FORMULA in C

#include<stdio.h> #include<conio.h> #include<math.h> #include<process.h> #include<conio.h> void main() { int n;                          // no. of terms. int i,j;                        // Loop variables float ax[10];                   // 'X' array limit 9 float ay[10];                   // 'Y' array limit 9 float x;                        // User Query for what value of X float nr,dr; float y=0;                      // Calculated value for coressponding X. float h;                        // Calc. Section float p,q;           ...

program in to implement Gauss Seidal method

# include <stdio.h> # include <conio.h> # include <math.h> # define MAXIT 50 # define EPS .000001 void main() { float a[10][10],b[10],x[10],sum,x0[10]; int i,j,n,count=0; clrscr(); printf("Enter Number of equation : "); scanf("%d",&n); printf("Enter Coefficients row by row \n"); printf("One row in each line\n"); for(i=1;i<=n;i++) for(j=1;j<=n;j++) scanf("%f",&a[i][j]); printf("Enter vector elements\n"); for(i=1;i<=n;i++) { x0[i]=x[i]=0; scanf("%f",&b[i]); } printf("N\t"); for(i=1;i<=n;i++) printf("X%d \t",i); printf("\n"); printf("-------------------------------------------------------------------\n"); s: printf("%d\t",count+1); for(i=1;i<=n;i++) { sum=0; for(j=1;j<=n;j++) { if(i==j) continue; else sum=sum+(a[i][j]*x[j]); } x[i]=(b[i]-sum)/a[i][i]; printf("%f \t",x[i])...

Newton Divided difference formula

# include <stdio.h> # include <conio.h> # define MAX 20 void main() { int i,j,n; float x[MAX],fx[MAX][MAX],xp,u,sum=0; printf("Newton Divided Difference formula \n"); printf("Enter No. of data points : "); scanf("%d",&n); printf("Enter values of X and f(x) set by set each at once \n"); for(i=1;i<=n;i++) scanf("%f%f",&x[i],&fx[i][1]); printf("Enter value of X at which interpolation is required : "); scanf("%f",&xp); for(i=2;i<=n;i++) for(j=1;j<=n-i+1;j++) fx[j][i]=(fx[j+1][i-1]-fx[j][i-1])/(x[j+i-1]-x[j]); printf("-------------------------------------------------------------------\n"); printf("X F(x) "); for(i=1;i<n;i++) printf("y%d ",i); printf("\n-----------------------------------------------------------------\n"); for(i=1;i<=n;i++) { printf("%4.2f\t ",x[i]); for(j=1;j<=n-i+1;j++) printf(...

first experience of blogging

This blog is for all computer learners. my goal to make this blog for c beginners and data structure students. i will try my best to update this on daily basis, so plz visit this . and say that you like this or not. and how can i make this better. thanx.

Program to implement BESSELS INTERPOLATION FORMULA in C

/*   Program to implement BESSELS INTERPOLATION FORMULA in C.       ------------------------------------ */ #include<stdio.h> #include<conio.h> #include<math.h> #include<process.h> #include<conio.h> void main() { int n;                          // no. of terms. int i,j;                        // Loop variables float ax[10];                   // 'X' array limit 9 float ay[10];                   // 'Y' array limit 9 float x;                        // User Query for what value of X float y;                      // Calculated value for coressponding X. float h;         ...

program to create two way linked list

program to create two way linked list. #include<stdio.h> #include<conio.h> #include<alloc.h> #define NULL 0 void main() { struct dnode { struct dnode *prev; int data; struct dnode *next; }*start,*temp,*k,*p,*pre; int i,c; char ch; clrscr(); start=NULL; for(i=0;i<=1;i++) { if(start==NULL) { temp=(struct dnode*)malloc(sizeof(struct dnode)); printf("\nEnter the value for node: -"); scanf("%d",&temp->data); start= temp; temp->prev=NULL; temp->next=NULL; } else { while(1) { printf("\nDo you want to create one more node(Y/N):- "); fflush(stdin); scanf("%c",&ch); if(ch=='y' || ch=='Y') { temp->next=(struct dnode*)malloc(sizeof(struct dnode)); printf("\nEnter the value of  node: -"); k=temp->next; scanf("%d",&k->data); k->prev=temp; k->next=NULL; temp=k; } else { te...

program to delete the element from linked list after the given value

program to delete the element from linked list after the given value. #include<stdio.h> #include<conio.h> #include<stdlib.h> #define NULL 0 struct node  {   int data;   struct node *link;  }*start,*temp,*prev,*n1; void display(); void main()  {   int n,i;   char ch;   clrscr();   start=NULL;   prev=NULL;   while(1)    {     if(start==NULL)      {                 temp=(struct node*)malloc(sizeof(struct node));                 printf("\nEnter value for Node:- ");                 scanf("%d",&temp->data);               ...

program to delete the element from linked list after the given position

program to delete the element from linked list after the given position. #include<stdio.h> #include<conio.h> #include<stdlib.h> #define NULL 0 struct node  {   int data;   struct node *link;  }*start,*temp,*prev,*n1; void display(); void main()  {   int n,i;   char ch;   clrscr();   start=NULL;   prev=NULL;     while(1)    {     if(start==NULL)      {                 temp=(struct node*)malloc(sizeof(struct node));                 printf("\nEnter value for Node :- ");                 scanf("%d",&temp->data);             ...

program in c to delete the element from linked list of last position element

W.A.P to delete the element from linked list of last position element. #include<stdio.h> #include<conio.h> #include<alloc.h> #define NULL 0 struct node { int data; struct node *link; }*start,*temp,*pre; void display(); void main() { int i,q,x; char ch; clrscr(); start=NULL; for(i=0;i<=1;i++) { if(start==NULL) { temp=(struct node*)malloc(sizeof(struct node)); printf("\nEnter value for node: -"); scanf("%d",&temp->data); start=temp; temp->link=NULL; } else { while(1) { printf("\nDo you want create one more node(Y/N):- "); fflush(stdin); scanf("%c",&ch); if(ch=='y' || ch=='Y') { temp->link=(struct node *)malloc(sizeof(struct node)); temp=temp->link; printf("\nEnter value for node: -"); scanf("%d",&temp->data); } else { temp->link=NULL; break; } } } } printf(...

Pogram to delete the element from linked list of first position element

Pogram to delete the element from linked list of first position element . #include<stdio.h> #include<conio.h> #include<alloc.h> #define null 0 void main() {  char c;  int i,p,j=0;  struct node  {   int data;   struct node *link;  }*temp,*start,*n,*prev;  clrscr();  start=null;  for(i=0;i<=1;i++)  {   if(start==null)   {    temp=(struct node *)malloc(sizeof(struct node));    printf("enter data:");    scanf("%d",&temp->data);    temp->link=null;    start=temp;    j++;   }   else   {    while(1)    {     printf("press n if you not want to add another node");     fflush(stdin);     c=getch();     if(c=='n'||c=='N')      break;   ...