0

How I can draw a patten like this

C CP CPR CPRO CPR CP C

10th Sep 2019, 2:44 PM
Ronak Pithava
3 odpowiedzi
+ 1
In which language?
10th Sep 2019, 2:51 PM
Jax
Jax - avatar
+ 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]); } } }
10th Sep 2019, 3:19 PM
KfirWe
KfirWe - avatar
0
In c programming only not in java Or c++
10th Sep 2019, 3:31 PM
Ronak Pithava