Assignment #1 Problem 2 Itcs102
# include <stdio.h>
int countkey(int array [], int, int);
void main ()
{
int array[8] , ke , s ;
printf("enter anumber");
scanf("%d", &ke);
s=8;
for ( int i = 0 ; i <= s ; i++)
scanf(" %d " , & array[i]);
int k = countkey( array, s, ke);
printf ("the number key = %d", k );
}
int countkey(int arr [], int size, int key){
if (size== 0)
return 0;
else if(arr[size-1]==key)
return 1 + countkey(arr,size-1,key);
else
return 0 + countkey(arr,size-1,key);
}
Re: Assignment #1 Problem 2 Itcs102
#include <stdio.h>
void printreverse ();
void main()
{
printf("Enter a word\n");
printreverse ();
}
void printreverse ()
{
char ch;
scanf("%c", &ch);
if (ch=='\n')
return;
else
{
printreverse ();
printf("%c", ch);
}
}
Re: Assignment #1 Problem 2 Itcs102