thats simple recursion. wait a second... are you trying to get us to do your homework?

import java.util.Scanner;
public class Mumupwn {
public static void main(String[] args) {
System.out.println("Enter an ODD number: ");
Scanner s1 = new Scanner(System.in);
int size = s1.nextInt();
System.out.println("Enter a single character: ");
String icon = s1.next();
String[] sa = new String[size];
StringBuilder sb = new StringBuilder();
String space = " ";
char[] ca = space.toCharArray();
char s = ca[0];
int midpoint = size / 2 + 1;
for ( int i = 0; i < size; i++ ){sb.append(icon);}
sa[midpoint - 1] = sb.toString();
int fLetter = 0;
int lLetter = size - 1;
int i = 1;
while ( i < midpoint){
sb.setCharAt(fLetter, s);
sb.setCharAt(lLetter, s);
sa[midpoint - 1 - i] = sb.toString();
sa[midpoint - 1 + i] = sb.toString();
fLetter++;
lLetter--;
i++;
}
for ( int j = 0; j < size; j++){System.out.println(sa[j]);}
}
} //31 Lines - Non Optimized with 1 import statement.
#include<iostream>
#include<string>
using namespace std;
int main() {
int a; string b; int i; int j;
cout << "Enter an ODD number";
cin >>a;
cout << "Enter a character";
cin >>b;
string c[a]; int d;
d=int(a/2)+1;
for(j=0; j<a; j++) { c[j]=" "; } //or c[j]="." if you want the dot as a space...
for(i=0; i<a; i++)
{
c[d]=b; c[d+i]=b; c[d-i]=b;
for (j=0; j<a; j++) {cout << c[j];}
cout <<"\
";
}
system("PAUSE"); //only for Windows
return 0;
}
#!/usr/bin/env perl
($num, $char, $count = 1, $flag = 0); # variables
print "Enter an odd number => ";
chomp($num = <>); # chomp gets rid of \
char
print "Enter a character => ";
chomp($char = <>);
while (1) {
print (" " x (int($num + 1 / 2) - $count), "$char " x $count,"\
");
if ($count < $num and $flag == 0) { $count += 2; } # Triangle's top
elsif ($count >= $num) { $count-= 2 and $flag = 1; } # switch from top to bottom
else { $count-= 2; } # Triangle's bottom half
last if ($count <= 0 and $flag == 1); # exit loop if condition true
}
#include<iostream>
using namespace std;
int main(){
int n; char inChar;
cout << "enter an odd number, followed by a space, then a character" << endl;
cin >> n >> inChar; //reads in both the integer and character
for (int i = 1; i <= n; i++){ //I'm not a fan of initializing For counters to 1,
for (int j = 1; j <= n; j++){ //But this makes the math easier
if (j <= abs((n-(2*i-1))/2) || j > (n-(abs((n-(2*i-1))/2)))){cout << " ";} //yeah, don't ask
else {cout << inChar;}
} cout << endl; // start up the next line
}
}
#!/usr/bin/env perl
($num, $char, $count); # variables
print "Enter an odd number follow by a character => ";
($num, $char) = split(" ", <STDIN>); # Getting input
for ($i = 1; $i <= $num; $i += 2){ # Top half of triangle
print (" " x (int($num + 1 / 2) - $i), "$char " x $i,"\
"); }
for ($count = $num - 2; $count >= 0; $count -= 2){ # Bottom half of triangle
print (" " x (int($num + 1 / 2) - $count), "$char " x $count,"\
"); }