- 26th Jan 2023
- 04:28 am
- Admin
C programming is a powerful and efficient language that is widely used for systems programming, embedded systems, and other applications that require tight control over the hardware. It is a popular choice among students and professionals who are looking to improve their programming skills.
C Programming assignment help and C Programming homework help can also provide students with valuable feedback on their work. They can help students identify and correct errors in their code, as well as improve the overall quality and efficiency of their programs.
In conclusion, C programming is a powerful and efficient language that is widely used for systems programming, embedded systems, and other applications that require tight control over the hardware. C Programming assignment help and C Programming homework help are valuable resources for students who are looking to improve their programming skills and complete their assignments and homework on time.
C Programming Solution Code:
#include
#include
#include
int sum(int L[],int N)
{
int totalSum=0;
for(int i=0;i {
totalSum+=L[i];
}
return totalSum ;
}
void highlow(int L[],int N,int *h, int *l)
{
*h=L[0];
*l=L[0];
for(int i=1;i {
if(L[i]>*h)
*h=L[i];
if(L[i]<*l)
*l=L[i];
}
}
int freq(int L[],int N,int v)
{
int count=0;
for(int i=0;i {
if(L[i]==v)
count++;
}
return count;
}
int addTo(int L[],int N,int v)
{
for(int i=0;i {
L[i]+=v;
}
}
void printList(int L[],int N)
{
for(int i=0;i printf("%d ",L[i]);
}
int main()
{
srand(time(0));
int a[20],b[100],h=0,l=0;
printf("FUNCTION TESTING FOR FIRST ARRAY\n\n");
for(int i=0;i<20;i++)
{
a[i]=i;
}
printf("\nSum of 20 element array is : %d",sum(a,20));
highlow(a,20,&h,&l);
printf("\n\nHighest Value is : %d, Lowest Value is : %d",h,l);
printf("\n\nNumber of time 5 appear in array is : %d",freq(a,20,5));
printf("\n\nElement in array before adding 10 to each element : \n\n");
printList(a,20);
addTo(a,20,10);
printf("\n\nElement in array after adding 10 to each element : \n\n");
printList(a,20);
printf("\n\nFUNCTION TESTING FOR SECOND ARRAY\n\n");
for(int i=0;i<100;i++)
{
b[i]=(rand() % (500 - 0 + 1)) + 0;
}
printf("\nSum of 100 element array is : %d",sum(b,100));
highlow(b,100,&h,&l);
printf("\n\nHighest Value is : %d, Lowest Value is : %d",h,l);
printf("\n\nNumber of time 255 appear in array is : %d",freq(b,100,255));
printf("\n\nFirst 20 element in array B before adding 20 to each element : \n\n");
printList(b,20);
addTo(b,20,20);
printf("\n\nFirst 20 element in array B after adding 10 to each element : \n\n");
printList(b,20);
return 0;
}