+ 8
How can I write a code to initialize an integer array with the following description
Integer array of 1000 elements to {1,2,3,4,5,......,1000} Integer array of 1000 elements to {1000,999,998,.....1} Pls will really appreciate your comment
44 Respuestas
+ 8
The guy just gave you the much needed help you requested for. He even explained it from start on how you can initialize your array the way yoh wanted for your code to run... Hey do this, i would suggest that you start your course afresh and work with each and every example yoy have been given in the course (practise makes perfect) then you will be able to write your own code.
Asking the guy ~ swim ~ to write you thr code is more like cheating, remember you said you have a pending exam and you need to pass it right? Well if so, then if the guy writes you the code, you will not get what to answer in your exam, i suggest watching youtube videos on your cpp course from beginner level and you will be where you want.
Happy coding😉 Keep coding🙏🏾
+ 4
Ipang "underages" ?!??😂😂😂
+ 3
Princez Beauty
Please mind language buddy!
+ 3
Here is my solution in c#
int arr = new int[1000];
for(int i = 0; i<len(arr); i++)
arr[i] = i+1
//this will generate 1 to 1000
for(int i = 1000; i>0;i--)
arr[i] = i
//this will generate 1000 to 1
In python
arr = [x for x in range(1,1001)]
#This will generate 1 to 1000
arr = [x for x in range(1000,0,-1)]
#This will generate 1000 to 1
+ 3
In php
-----------------------
$a = array();
For($i = 1; $i≤1000; $i++)
{$a[] = $i;}
-----------------------
$b = array();
For($i = 1000; $i≥1; $i--)
{$b[] = $i;}
+ 2
"I just need 2 pass my f* exam"
Please understand we have underages here. Show good example?
+ 2
We all make mistakes buddy,
But can you please censor that word? I'd be grateful if you would 👍
+ 2
Props to ~ swim ~ for taking his time to reply to this nonsense
+ 1
Am not a computer student and I know nothing concerning it so will b grateful if u can answer me or check if am correct or not
+ 1
Thanks
+ 1
Ok am sorry 4 that my bad pls 4give me
+ 1
😭😭😭😭😓
+ 1
Run any loop to assign the number to respective array.
+ 1
//as in c language
int arr[1000];
I=1;
while(I)
{
if(l==1001)
{Break;}
arr[I-1]=l;
I++;
}
//basic idea
+ 1
JAY AJ i like that array definition. Princez Beauty work with this, and add it in your code
0
Don't know if am correct
0
Sorry
0
If am wrong then u correct me plssss am not asking 4 much I want 2 learn
0
You must declare an int array of size 1000 ints
int arr[1000];
run a for loop from 1 to 1000 to store the values into it
int i; /*for count elements*/
for (i = 0; i < 1000; i++)
arr[i] = i+1;
Indexing from 0 to 999 not from 1 to 1000.
This will initialize array values from 1 to 1000
Now you should be able to write a code if you want to store the values from 1 to 1000:
0
Hi