undefined
hi,
i m naya.i m student of telecommunicatin engineering.i have a lot problems in "C PROGRAMMING".plz tell me the codes to find max,min values....to print factorial of a number...how copy an array to other.....to print tables of numbers....n how to swaps in array..
plz they all codes should be in arrays...plz help me
in 21 nov i will give exam in my uni. of "ARRAYS IN C"
I SHALL BE VERY TO U.....
BYE
naya
 3 Contributors
 forum2 Replies
 3 Views
 13 Years Discussion Span
 comment Latest Post by harshchandra
Narue 5,707
I have a better idea. You prove that you've tried to solve these problems on your own, and we'll help you with any errors. No one is going to do your homework for you.
harshchandra 3
oh sure !! i can help you out.Here are the codes
1. Finding Maximum and minimum values in a array
# include<stdio.h>
# define MAX 10
void main()
{ int a[MAX],i,mini,maxi;
for(i=0;i<MAX;i++)
{ printf("Enter Any number : ");
scanf("%d",&a[i]);
}
mini=a[0];
maxi[0];
for(i=1;i<MAX;i++)
{ if(a[i]>max)
maxi = a[i];
if(a[i]<min)
mini = a[i];
}
printf("The minimum and maximum no in the given array is %d and %d",mini,maxi);
getch();
}

Sorting an array.
There are many techniques to sort a given array .One of it is given below.This code sorts the array in an ascending order , if u want to sort in descending order just change the sign from ">" to "<" in the code.rest all wil remain as it is .include<stdio.h>
define MAX 10
void main()
{ int a[MAX],i,j,temp;
for(i=0;i<MAX;i++)
{ printf("Enter Any number : ");
scanf("%d",&a[i]);
}
for(i=0;i<MAX;i++)
{ for(j=i+1;j<MAX;j++)
{ if(a[i]>a[j])
{ temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
printf("The sorted Array is : \n");
for(i=0;i<MAX;i++)
{ printf("%d\n",a[i]);
}
getch();
} 
Factorial of a given numbers , i m taking an example that an array consist of 10 elements and i have to find the factorial of each number ,and store it in seperate array and finally printing printing the array.
include<stdio.h>
include<conio.h>
define MAX 10
void main()
{ long int a[MAX],fact[MAX],i,j;
int pro;
for(i=0;i<MAX;i++)
{ printf("Enter Any number : ");
scanf("%ld",&a[i]);
}
for(i=0;i<MAX;i++)
{ pro=1;
for(j=1;j<=a[i];j++)
{ pro *=j;
}
fact[i]=pro;
}
for(i=0;i<MAX;i++)
{ printf("\nFactorial of %d : ",a[i]);
printf("%ld\n",fact[i]);
}
getch();
}
I hope all these codes will be helpful to you.All the best for your Exams .
cheers,
Harsh chandra
Edited
by happygeek: fixed formatting
Dave Sinkula
commented:
Use code tags. +0