+ 1

Write a program to print following patter

* * * * * * * * * * * * * * * using only four printf

14th May 2017, 11:22 AM
Prakash Kumar Gautam
Prakash Kumar Gautam - avatar
2 Answers
+ 6
Define a function to print 5 * symbols. We should use one printf in that. A call to this function would print first and last lines of the pattern. Use 3 printf statements for remaining 3 lines.
14th May 2017, 1:03 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
0
public class Star(){ for(int a=0; a<=5; a++){ printf("*"); } } public class main void(string[] args){ S object = new Star(); S.Star(); printf("*. *"); printf(". *. "): printf("*. *"); S.Star(); }
14th May 2017, 1:41 PM
Shivam Tiwari
Shivam Tiwari - avatar