Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
write a program to divide each element of array by 5 and give me final array of number who are divided by 5.

What I have tried:

i tried but did not get output..
Posted
Updated 21-Mar-18 4:22am
v2
Comments
Jochen Arndt 21-Mar-18 9:03am    
You should show us what you have tried so far. Without that you won't get help here because nobody is going to write your assignment for you.

Use the green "Improve question" link to add the code written so far (copy and paste selecting "Code block"). Add also some information what is not working as expected.
CPallini 21-Mar-18 10:03am    
Show us WHAT you've tried.

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!
Hint: This isn't difficult: create an array the same size as the input array. Use a for loop to process each element from the input, and copy the divided value to the output:
C++
output[i] = input[i] / 5;


If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 
Quote:
i tried but did not get output..

We help you to fix your code, but you need to show that code.

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
 
Share this answer
 
Just a bit of advice and a thought:

Most good and really good programmers started to code before they were in school and given assignments. They did it because they love to do it. A very many are self taught and never took a class.

If you don't find yourself captivated by solving these problems, realize that it will only get more difficult down the road and leave you and a lot of other people in trouble with code that you only found to be a burden.


 
Share this answer
 
Comments
george romany 4-Sep-22 16:34pm    
hi;
i want to divide all array numers /int and store the result in a new array

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900