ThoughtWorks
Programming and Technical
Programming
Program
Using recursion print numbers of an array.
Read Solution (Total 6)
-
- int print(int a[],int i,int n){
if(i - 10 years agoHelpfull: Yes(3) No(0)
- void print(int arr[], int n, int i){
if(i - 9 years agoHelpfull: Yes(1) No(0)
- simple java code...
import java.util.Scanner;
class RecArray
{
private static int i=0;
static void print(int A[])
{
if(i==A.length)
{
return;
}
System.out.println(A[i]);
i++;
print(A);
}
public static void main(String[] args)
{
System.out.print("nEnter the no. of elements : ");
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int A[] = new int[n];
System.out.println("nEnter the array elements :");
for(int a=0;a - 9 years agoHelpfull: Yes(1) No(0)
- #include
#include
void fun(int a[],int,int);
int main()
{
int s;
printf("enter size of array");
scanf("%d",&s);
int a[s],i,temp=0;
printf("enter nos of arrayn");
for(i=0;i0)
{
printf("%dn",a[index]);
index++;
size--;
fun(a,size,index);
}
return;
} - 8 years agoHelpfull: Yes(0) No(0)
- #include
using namespace std;
void rec(int a[],int n)
{
if(n==0)
return;
else
{
cout - 8 years agoHelpfull: Yes(0) No(0)
- #include
#define MAX 100
int fun(int p[],int);
int main()
{
int a[MAX],i,n;
printf("enter the values of n: ");
scanf("%d",&n);
printf("nenter the array elements: ");
for(i=0;i - 8 years agoHelpfull: Yes(0) No(0)
ThoughtWorks Other Question