Finding 1st & 2nd Difference In An Array C Program Tamil


#include<stdio.h>
#include<conio.h>
void main()
{
     int a[100],d1[100],d2[100],i,n;
     clrscr();
     printf("\nENter the limit : ");
     scanf("%d",&n);
     printf("\nEnter the values :");
     for(i=0;i<n;i++)
     {
	scanf("%d",&a[i]);
     }
     printf("\nValues \n");
     for(i=0;i<n;i++)          //www.tutorjoes.com
     {
       printf(" %d",a[i]);
     }
     printf("\nFirst difference\n");
     for(i=0;i<n-1;i++)
     {
       d1[i]=a[i+1]-a[i];
       printf(" %d",d1[i]);       //www.tutorjoes.com
     }
      printf("\nsecond difference\n");
   for(i=0;i<n-2;i++)
   {
     d2[i]=d1[i+1]-d1[i];          //www.tutorjoes.com
     printf(" %d",d2[i]);
   }
   getch();
}

Login To Download Source Code

Leave a Comment:

Login To Comment

List Of Programs


Goto Examples

Operators

Looping

Number Conversion

Pattern Design

Arrays

Matrix Examples

Sorting Examples

String Function

Change Case

String In C

Maths Functions

User Defined Functions

Recursive Functions

Pointer

Structure

File Concept

Calender Programming