0
How I can draw a patten like this
C CP CPR CPRO CPR CP C
3 Answers
+ 1
In which language?
+ 1
You didn't answer what language so i write a code in java:
package test;
public class myclass
{
/**
* @param args
*/
public static void main(String[] args)
{
String str="enjoy";
String[]arr=new String[str.length()];
for(int u=0;u<arr.length;u++){
arr[u]="";
}
for(int i=0;i<str.length();i++){
for(int j=0;j<i+1;j++){
System.out.print(str.charAt(j));
arr[i]=arr[i]+str.charAt(j);
}
System.out.println("");
}
for(int h=0;h<arr.length;h++){
if(h==0){
continue;
}
System.out.println(arr[arr.length-1-h]);
}
}
}
0
In c programming only not in java Or c++