0
1 13 135 1357 ....... ...... ......... n lines
2 Antworten
+ 1
//example n = 17
void odd(int n)
{ 
  int oddNr = 1;
  for(int c = 1 ; c <= n ; ++c)
    {  cout<<oddNr;
       oddNr += 2;
    }
   cout<<endl;
}
int main()
{
  for(int x = 1 ; x <= 17; x++)
   {
     odd(x);
    }
return 0;  
}
+ 1
Ah, you wanted a nested loop
in that case, for n = 10 lines:
int main()
{
   for(int i = 1 ; i <= 10 ; i++)
   {   
     int odd = 1;
       for(int j = 1 ; j <= i; j++)
      {
        cout<<odd;
        odd += 2;       
       }
   cout<<endl;
    }
return 0;
}



