Apr

19

TECH MARATHON - A 24 HRS TECHNO BRAIN RACE

TECH MARATHON – A 24 HRS TECHNO BRAIN RACE

Apr

19

TECH MARATHON - A 24 HRS TECHNO BRAIN RACE

TECH MARATHON – A 24 HRS TECHNO BRAIN RACE

Apr

04

      1. Write a ‘C’ program to find the smallest and biggest value in a single dimensional array using array and pointer concepts.
      2. write a C program using pointer to sort the given list of numbers in ascending order.

Apr

04

//———————————————— arp2.c ———————————–

// find the sum of array elements using pointer

#include<stdio.h>
void main(){
int a[5];
int *ptr;
int i,sum=0;
printf(“Enter Five Numbers:\n”);
for(i=0;i<5;i++){
scanf( “%d”,&a[i]);
}
ptr=a;
for(i=0;i<5;i++){
sum=sum+*(ptr+i);
}
printf(“Addition is: %d\n”,sum);
}

Apr

04

//——————————– arp1.c ———————————————

#include<stdio.h>
void main(){
int a[5];
int *ptr;
int i;
printf(“Enter Five Numbers:\n”);
for(i=0;i<5;i++){
scanf( “%d”,&a[i]);
}
ptr=a;
printf(“\n Value of ptr is: %d\n”,ptr);
printf(“Entered Five Numbers is:\n”);
/*for(i=0;i<5;i++){
printf(“%d\n”,*ptr+i);
}*/
for(i=0;i<5;i++){
printf(“%d\n”,*(ptr+i));
}
printf(“\n Value of ptr is: %d”,ptr);
printf(“\n——————————–\n”);
for(i=0;i<5;i++){
printf(“%d\n”,*ptr++);
}
printf(“\n Value of ptr is: %d”,ptr);
}