before every thing thank you for helping , and Im asking if these answer is right :
# include <iostream>
using namespace std ;
int main ()
{
int alpha[50];
for (int i=0;i<25;i++)
{
alpha[i]=i*i;
cout<<alpha[i]<<" ";
for(i=25;i<50;i++)
{
alpha[i]=3*i;
cout<<alpha[i]<<" ";
}
return 0
}
also I have question how can I print 10 elements per line if I had 2 loop
and thank you very much ,
You're on the right track. Another solution would be to use only one
for loop and use an
if else test condition to test for the first 25, do whatever...
As regards printing 10 per line, you could make use of the % modulus operator to determine whether a newline should be printed
if (i % 10 == 0) .
I hope this is of value.
Reputation Points: 11
Solved Threads: 3
Junior Poster in Training
Offline 66 posts
since Nov 2007