Posts

Showing posts with the label array

Dictionary Program in C language

Image
Hello Guys, Today I am going to post a nice dictionary program, developed in "C" Language, by using 2-Dimensional Array. Following is the code and output  of the program. 1. Source Code of the Program:  #include<stdio.h> //Standard Input-Output, Header File #include<conio.h> //Console input-Output Header File #include<string.h> // Header file for String Handling #include<graphics.h> // Header File for graphics-implementation int g1,g2;    //global variable for storing position to fetch the record. //Functions for each alphabet to store and fetch word-meanings. char A() {  char x[50][100]={"aberrant=deviating ","abate=subside/diminish","abominable=unequivocally detestable; loathsome.","abscond=to leave hurriedly and secretly.","abyssopelagic=of, like or pertaining to the depths of the ocean.","absolution=the act of absolving or the state of being absolved.","acata...

Program for accepting values in array and sort them in ascending order.

Program for accepting values in array and sort them in ascending order. /*Program for accepting values in array and sort them in ascending order.*/ #include<stdio.h> #include<conio.h> void main() { int a[5],i,j,t; clrscr(); printf("\nEnter 5 values in array: "); for(i=0;i<=4;i++) { scanf("%d",&a[i]); } printf("\nBefore arranging array values are:"); for(i=0;i<=4;i++) { printf("%d\t",a[i]); } for(i=0;i<=4;i++) { for(j=i+1;j<=4;j++) { if(a[i]>a[j]) { t=a[i]; a[i]=a[j]; a[j]=t; } } } printf("\nAfter arranging in accending order array values are: \n"); for(i=0;i<=4;i++) printf("%d\t",a[i]) ; getch(); }

Program for accepting values in an array and finding greatest and smallest value in that array.

Program for accepting values in an array and finding greatest and smallest value in that array. /*Program for finding greatest and smallest value in an array.*/ #include<stdio.h> #include<conio.h> void main() { int a[5],i,g,s; clrscr(); printf("\nEnter 5 values in array: \n"); for(i=0;i<=4;i++) { scanf("\n%d",&a[i]); } g=s=a[0]; printf("\n Accepted array values are:"); for(i=0;i<=4;i++) { if(g<a[i]) g=a[i]; if(s>a[i]) s=a[i]; printf("%d\t",a[i]); } printf("\n Greatest value is=%d",g); printf("\n\n Smallest value is=%d",s); getch(); }

A Program for accepting values to 2-Dimensional array and finding the sum of all the elements of 2-Dimensional array.

A Program for accepting values to 2-Dimensional array and finding the sum of all the elements of 2-Dimensional array. Just copy and paste the code below and compile and run the program. #include<stdio.h> #include<conio.h> void main() { int a[3][3],i,j,s=0; clrscr(); for(i=0;i<3;i++) { for(j=0;j<3;j++)     {       printf("\nEnter a value:");       scanf("%d",&a[i][j]);     }   } printf("\nYour array\n"); for(i=0;i<3;i++) {   for(j=0;j<3;j++)   {   s=s+a[i][j];   printf("%d\t",a[i][j]);   } } printf("\nSum of array elements=%d",s); getch(); }