ram rs
BAN USER#include<stdio.h>
int reverse_elements(int a[20],int first,int last)
{
int temp;
while(first<last)
{
temp=a[first];
a[first]=a[last];
a[last]=temp;
first++;last--;
}
return 0;
}
int main()
{
int a[20],len,i,k;
printf("enter the length of the array:\n");
scanf("%d",&len);
printf("enter the kth element:\n");
scanf("%d",&k);
printf("enter the array elements:\n");
for(i=0;i<len;i++)
scanf("%d",&a[i]);
reverse_elements(a,0,len-1);
reverse_elements(a,0,k-1);
reverse_elements(a,k,len-1);
printf("result array:\n");
for(i=0;i<len;i++)
printf("%d\t",a[i]);
return 0;
}
think this would work well for three integer array:
#include<stdio.h>
#include<stdlib.h>
int main()
{
int *a,*b,*c,len,i,j;
printf("enter the length of array:\n");
scanf("%d",&len);
a=(int *)calloc(len,sizeof(int));
if(a==NULL){printf("memory error:");return 0;}
b=(int *)calloc(len,sizeof(int));
if(b==NULL){printf("memory error:");return 0;}
c=(int *)calloc(len,sizeof(int));
if(c==NULL){printf("memory error:");return 0;}
printf("enter the array1 elements:\n");
for(i=0;i<len;i++)
scanf("%d",&a[i]);
printf("enter the array2 elements:\n");
for(i=0;i<len;i++)
scanf("%d",&b[i]);
printf("enter the array3 elements:\n");
for(i=0;i<len;i++)
scanf("%d",&c[i]);
for(i=0;i<len;i++)
printf("%d %d %d\n",a[i],b[i],c[i]);
return 0;
}
#include<stdio.h>
#include<stdlib.h>
int main()
{
static int max,j,i,a[26];
char d[40];
printf("enter the string in small letter:\n");
scanf("%s",d);
while(d[i])
++a[d[i++]-97];
max=a[0];
for(i=1;i<26;i++)
{
if(max<a[i]){
max=a[i];j=i;}
}
printf(" the maximum occurance of character is :%c",j+97);
return 0;
}
will this idea work pls correct me if I am wrong:)
- ram rs April 19, 20131.create two hash tables one for string 1 and another for string 2
2.if the hash values of string 2 if it is contained within string 1 then string is accepted....