E
engartte
Hi all,
I did the solution with consultation of some experts on the following
problem:
Declare an array of length of 10 and read integers into the elements of
the array from keyboard.Then read an integer which specifies the number
of repetition. According to the repetition number,print the contents of
the array?
output example:
1 2 3 4 5 6 7 8 9 10
3
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
the solution is :
#include <stdio.h>
int main()
{
int a[10], temp;
int i,j;
for(i=0; i<10; i++){
a = i+1;
printf("%d ",a);
}
printf("\nType a number:");
scanf("%d", &temp);
for(i=0;i<x;i++){
for(j = 0; j<10; j++){
printf("%d ",a[j]);
}
printf("\n");
}
return 0;
}
now,I am asking you all experts that what is the another
more proper alternative way to pay for this problem,excpet
the follow-up solution?
tanx in advance
engartte
I did the solution with consultation of some experts on the following
problem:
Declare an array of length of 10 and read integers into the elements of
the array from keyboard.Then read an integer which specifies the number
of repetition. According to the repetition number,print the contents of
the array?
output example:
1 2 3 4 5 6 7 8 9 10
3
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
the solution is :
#include <stdio.h>
int main()
{
int a[10], temp;
int i,j;
for(i=0; i<10; i++){
a = i+1;
printf("%d ",a);
}
printf("\nType a number:");
scanf("%d", &temp);
for(i=0;i<x;i++){
for(j = 0; j<10; j++){
printf("%d ",a[j]);
}
printf("\n");
}
return 0;
}
now,I am asking you all experts that what is the another
more proper alternative way to pay for this problem,excpet
the follow-up solution?
tanx in advance
engartte