Академический Документы
Профессиональный Документы
Культура Документы
en_US
interview mantra
en_US
interview mantra
Enter your em
search_block_for
form-iuhUTG2-GW Search
Programming Simplified
c c++ and java source codes programs and programming tutorials
Search form
Search
C Programming Tutorials C Graphics source codes Submit ProgramYou are here Home C programming C programming examples c program to print patterns of numbers and stars C Mouse Programs C programming examples C Source codes Java programs graphics.h C graphics programs conio.h math.h dos.h
c programming examples
Hello world Print Integer Addition Odd or Even Add su!tract multipl" and divide Chec# vowel
$eap "ear Add digits %actorial HC% and $CM &ecimal to !inar" conversion nc' and nPr Add n num!ers Swapping 'everse num!er Palindrome num!er Print Pattern &iamond Prime num!ers %ind armstrong num!er (enerate armstrong num!er %i!onacci series Print )lo"d*s triangle Print pascal triangle Addition using pointers Maximum element in arra" Minimum element in arra" $inear search +inar" search 'everse arra" Insert element in arra" &elete element )rom arra" Merge arra"s +u!!le sort Insertion sort Selection sort Add matrices Su!tract matrices ,ranspose matrix Multipl" two matrices Print string String length Compare strings Cop" string Concatenate strings 'everse string %ind palindrome &elete vowels C su!string Sort a string
'emove spaces Change case Swap strings Character*s )re-uenc" Anagrams 'ead )ile Cop" )iles Merge two )iles $ist )iles in a director" &elete )ile 'andom num!ers Add complex num!ers Print date (et IP address Shutdown computer C (raphics Pro.ect &evelopment ,utorial (ame Programming ,utorial
/e have shown )ive rows a!ove in the program "ou will !e as#ed to enter the num!ers o) rows "ou want to print in the p"ramid o) stars.
C programming code
#include<stdio.h> main() { int row, c, n, temp;
");
ou wish to see scanf("!d","n); temp # n; for ( row # $ ; row <# n ; row%% ) { for ( c # $ ; c < temp ; c%% ) printf(" "); temp&&; for ( c # $ ; c <# '*row & $ ; c%% )
("*"); ) ) printf("(n");
return *;
Output0
Consider the pattern 1 11 111 1111 11111 to print a!ove pattern see the code !elow0
#include<stdio.h> main() { int n, c, +; printf("Enter number of rows(n"); scanf("!d","n); for ( c # $ ; c <# n ; c%% ) {
return *;
%or more patterns or shapes on num!ers and characters see comments !elow and also see codes on )ollowing pages0 %lo"d triangle Pascal triangle
C programming:
C programming examples
Comments
(uest 2not veri)ied3 Wed, 29/06/2011 - 13:24 Permalin#
thanks
i am searching same and i got (uest 2not veri)ied3 Wed, 29/06/2011 - 13:52 Permalin#
help
can "ou explain the code the loop coding. adminPs Sun, 10/07/2011 - 23:00 Permalin#
program explanation
,he )irst loop is )or num!er o) rows second )or printing re-uired spaces and last one to print stars 2 412row num!er3 5 6 3. (uest 2not veri)ied3 Mon, 11/07/2011 - 00:02 Permalin#
Compliment
sir "our site is awesome....... i reall" li#e it and learned lot )rom it.03 (uest 2not veri)ied3 Mon, 11/07/2011 - 00:06 Permalin#
problem
Sir i have some pro!lem regarding loop. Sometime i cant understand how loop is wor#ing and i cant implement it right too. How can i improve m" understanding s#ill please help i) possi!le. (uest 2not veri)ied3 Thu, 04/08/2011 - 11:13 Permalin#
thank you
i was loo#ing )or it (uest 2not veri)ied3 Thu, 04/08/2011 - 20:46 Permalin#
* * * * * * * * * *
2etch(); return *;
please help
i need c program to print no in this )ormat 6 64 649 649: adminPs Sun, 07/08/2011 - 11:32
Permalin#
source code
#include<stdio.h> main() { int number # $, n, c, +; printf("Enter number of rows(n"); scanf("!d","n); for ( c # $ ; c <# n ; c%% ) { for( + # $ ; + <# c ; +%% ) { printf("!d ", number); number%%; ) number # $; ) ) printf("(n");
return *;
for ( c # $ ; c <# n ; c%% ) { for( + # $ ; + <# c ; +%% ) printf("!d ", +); ) ) printf("(n");
return *;
code
#include<stdio.h> main() { int n, c, +; printf("Enter number of rows(n"); scanf("!d","n); for ( c # $ ; c <# n ; c%% ) { for( + # $ ; + <# c ; +%% ) printf("* "); ) ) printf("(n");
return *;
Permalin#
return *;
) return *;
for ( c # n & ' ; c ># * ; c&& ) { for ( + # c ; + ># * ; +&& ) printf("*"); ) ) printf("(n");
return *;
need help
i need program to print the )ollowing pattern 00 6 49 :=> ? @ A 6B adminPs Fri, 12/08/2011 - 07:31 Permalin#
'loyd*s triangle
,his pattern is %lo"d*s triangle see %lo"d*s ,riangle code. (uest 2not veri)ied3 Fri, 12/08/2011 - 18:48 Permalin#
return *;
code
gu"s i need the code )or this
* **
return *;
return *;
"oubt
In the program instead o) the statement spaceC41#56D can we go )or the statement spaceEC4D 8 adminPs Mon, 22/08/2011 - 13:01
Permalin#
sure
<ou can use !ut don*t )orget to initialiFe varia!le space to one. (uest 2not veri)ied3 Tue, 16/08/2011 - 21:34 Permalin#
int n, c, d, num # $, space; scanf("!d","n); space # n & $; for ( d # $ ; d <# n ; d%% ) { num # d; for ( c # $ ; c <# space ; c%% ) printf(" "); space&&; for ( c # $ ; c <# d ; c%% ) { printf("!d", num); num%%; ) num&&; num&&; for ( c # $ ; c < d ; c%%) { printf("!d", num); num&&; )
printf("(n"); ) ) return *;
int n, +, c, space, :, num # $; cin >> n; : # n; for ( + # $ ; + <# n ; +%% ) { for ( c # $ ; c <# + ; c%% ) { cout << num; num%%; ) num&&; for ( c # $ ; c <# '*: & 3 ; c%% ) cout << " "; :&&; if ( + ;# n ) { for ( c # $ ; c <# + { cout << num; num&&; ) )
; c%% )
else {
) )
printf("(n"); num # $;
return *;
c programming code
please get me the code o) the c program to get the output as )ollows0 6 646 64946 649:946 649:=:946 adminPs Thu, 18/08/2011 - 22:10 Permalin#
int n, c, +, : # $; scanf("!d", "n); for ( c # $ ; c <# n ; c%% ) { for ( + # $ ; + <# c ; +%% ) { printf("!d", :); :%%; ) :&&; for ( + # $ ; + <# c & $ ; +%% ) {
) )
printf("(n"); : # $;
return *;
char strin2<$**=; int c, +, len2th; printf("Enter a strin2(n"); 2ets(strin2); len2th # strlen(strin2); for ( c # * ; c < len2th ; c%% ) { for( + # * ; + <# c ; +%% ) { printf("!c", strin2<+=); ) printf("(n"); )
return *;
int n, c, +, num # $; scanf("!d", "n); for ( c # $ ; c <# n ; c%% ) { for ( + # $ ; + <# c ; +%% ) { printf("!d", num); if ( num ## * ) num # $; else num # *;
) )
) printf("(n");
return *;
c language
diamond pattern o) stars adminPs
diamond pattern
&iamond pattern (uest 2not veri)ied3 Sat, 20/08/2011 - 18:07 Permalin#
char ch # @,@; int n, c, +, space # *; scanf("!d", "n); for ( + # n ; + ># $ ; +&& ) { for ( c # $ ; c <# space ; c%%) printf(" "); space%%; for ( c # $ ; c <# + ; c%% ) { printf("!c ", ch); ch%%; )
) )
printf("(n"); ch # @,@;
return *;
return *;
Programming Simplified is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. Home | About Us | Contact Us | Programmer Resources | Site Map | Privacy | Download Software
o o o o
i 99 Hotes
Computer languages are not as eas" as human languages the" need "ou to !ecome a computer "oursel) thin# li#e a computer and write an algorithm. Computer programs are )un i) "ou ta#e them up as a challenge as unsolved puFFles. ,here is lot o) )un in ta#ing up the challenge understanding the pro!lem writing an algorithm writing a program and most importantl" running the program and o!taining re-uired output. Here are )ew challenging C program -uestions )or "ou. $etKs see how man" o) them "ou would !e a!le to write without seeing the program solution given !elow. ,hese -uestions are to print patterns using asteris#2star3 character. Comment !elow i) "ou have tougher pattern -uestions.
$*. * * * * * * * * * * *
4$. 4'.
* * * * * * * *
6*. * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * *
69. 7*.
* * * *
96. * * * * * * * * * * * * * * * * * * * * * * * * *
Program0
A* Bhis is a simple mirror&ima2e of a ri2ht an2le trian2le *A
#include int main() { char prnt # @*@; int i, 1, nos # 4, s; for (i # $; i <# 5; i%%) { for (s # nos; s ># $; s&&) { printf(" ) for (1 # $; 1 <# i; 1%%) { printf("!'c", prnt); ) printf("(n"); &&nos; ) return *; )
&ownload Code
AA Cpacin2 factor
");
+ac# to top
* * * * * * * * * * *
Program0
#include int main() { char prnt # @*@; int i, 1, +, s, c # $, nos # 9; for (i # $; c <# 4; i%%) { AA ,s we want to print the columns in odd seDuence EiF. $,3,5,.etc if ((i ! ') ;# *) { for (1 # $; 1 <# i; 1%%) { spacin2 factor if (c ## 4 "" s ## $) { brea+; ) printf(" ) for (+ # $; + <# i; +%%) { if (c ## 4 "" + ## 5) { brea+; ) "); printf("!'c", prnt); ) for (s # nos; s ># $; s&&) { AABhe
+ac# to top
Program0
#include int main() { char prnt # @*@; int i, 1, +, s, p, r, nos # 7;
for (i # $; i <# 5; i%%) { for (1 # $; 1 <# i; 1%%) { if ((i ! ') ;# * "" (1 ! ') ;# *) { printf("!3c", prnt); ) else "); ) ) for (s #
if ((i ! ') ## * "" (1 ! ') ## *) { printf("!3c", prnt); ) else { printf(" nos; s ># $; s&&) { printf(" ) "); AA for the spacin2 factor
for (+ # $; + <# i; +%%) { AAGoinin2 seperate fi2ures if (i ## 5 "" + ## $) { if ((+ ! ') ;# *) { printf("!3c", prnt); ) else { printf(" & '; AA space control ) nos # $;
continue; )
for (r # $; r <# p; r%%) { if ((p ! ') ;# * "" (r ! ') ;# *) { printf("!3c", prnt); ) else if ((p ! ') ## * "" (r ! ') ## *) { printf("!3c", prnt); ) else { printf(" nos; s ># $; s&&) { printf(" ) for (+ # $; + <# p; +%%) { if ((+ ! ') ;# *) { printf("!3c", prnt); ) else { printf(" ) ) nos # nos % '; printf("(n"); ) AA space control "); "); "); ) ) for (s #
return *; )
&ownload Code
Explanation0 ,his can !e seen as an inverted diamond composed o) stars. It can !e noted that the composition o) this )igure )ollows se-uential pattern o) consecutive stars and spaces. In case o) odd row num!er the odd column positions will !e )illed up with L1K else a space will !e spaced and vice5versa in case o) even num!ered row. In order to achieve this we will construct )our di))erent right angle triangles aligned as per the re-uirement.
+ac# to top
Program0
#include int main() { char prnt # @*@; int i, 1, s, nos # *;
for (i # 9; i ># $; (i # i & ')) { for (s # nos; s ># $; s&&) { printf(" ) for (1 # $; 1 <# i; 1%%) { if ((i ! ') ;# * "" (1 ! ') ;# *) { printf("!'c", prnt); ) else { printf(" ) ) printf("(n"); nos%%; ) nos # 3; for (i # 3; i <# 9; (i # i % ')) { for (s # nos; s ># $; s&&) { printf(" ) for (1 # $; 1 <# i; 1%%) { "); "); ");
Program0
#include int main() { char prnt # @*@; int i, 1, +, s, nos # 4;
for (i # $; i <# 5; i%%) { for (s # nos; s ># $; s&&) { printf(" ) for (1 # $; 1 <# i; 1%%) { printf("!'c", prnt); ) for (+ # $; + <# (i & $); +%%) { if (i ## $) { printf("(n"); nos&&; ) continue; ) printf("!'c", prnt); ) ");
for (s # nos; s ># $; s&&) { printf(" ) for (1 # $; 1 <# i; 1%%) { printf("!'c", prnt); ) for (+ # $; + <# (i & $); +%%) { printf("!'c", prnt); ) nos%%; printf("(n"); ) nos # 3; for (i # '; i <# 5; i%%) { if ((i ! ') ;# *) { for (s # nos; s ># $; s&&) { printf(" ) for (1 # $; 1 <# i; 1%%) { "); ");
Program0
A* Bhis can be seen as two ri2ht an2le trian2les sharin2 the same base which is modified b *A #include addin2 few e:tra shiftin2 spaces
AA Bhis function controls the inner loop and the spacin2 AA factor 2uided b the outer loop inde: and the spacin2 inde:.
int trian2le(int nos, int i) { char prnt # @*@; int s, 1; for (s # nos; s ># $; s&&) { printf(" ) for (1 # $; 1 <# i; 1%%) { printf("!'c", prnt); ) return *; ) AABhe inner loop "); AA Cpacin2 factor
int main() { int i, nos # 5; AAdraws the upper trian2le for (i # $; i <# 4; i%%) { trian2le(nos, i); printf("(n"); AAHnner loop construction ) nos # 7; nos%%;
s+ippin2 its base. for (i # 3; i ># $; i&&) { int 1 # $; trian2le(nos, i); nos # nos & 1; printf("(n"); ) AA Hnner loop construction AA Cpacin2 factor
return *; )
&ownload Code +ac# to top
* * * * * * * * *
Program0
#include
int main() { char prnt # @*@; int i, 1, +, s, nos # &$; for (i # 5; i ># $; i&&) { for (1 # $; 1 <# i; 1%%) { printf(" ) for (+ # $; + <# i; +%%) { if (i ## 5 "" + ## 5) { "); printf("!'c", prnt); ) for (s # nos; s ># $; s&&) {
continue; ) printf("!'c", prnt); ) nos # nos % '; printf("(n"); ) nos # 5; for (i # '; i <# 5; i%%) { for (1 # $; 1 <# i; 1%%) { printf(" ) for (+ # $; + <# i; +%%) { if (i ## 5 "" + ## 5) { brea+; ) printf("!'c", prnt); ) nos # nos & '; printf("(n"); ) return *; )
&ownload Code +ac# to top
");
* * * * * * * * * * * * * * * * * * * * * * * * *
Program0
#include int main() { char prnt # @*@; int i, 1, +, s, sp, nos # *, nosp # &$; for (i # 9; i ># 3; (i # i & ')) { for (s # nos; s ># $; s&&) { printf(" ) for (1 # $; 1 <# i; 1%%) { printf("!'c", prnt); ) for (sp # nosp; sp ># $; sp&&) { printf(" ) for (+ # $; + <# i; +%%) { if (i ## 9 "" + ## $) { continue; ) printf("!'c", prnt); ) nos% "); ");
%; nosp # nosp % '; printf("(n"); ) nos # 4; for (i # 9; i ># $; (i # i & ')) { for (s # nos; s ># $; s&&) { printf(" ) ");
return *; )
&ownload Code +ac# to top
Program0
#include A* * nos # Ium. of spaces reDuired in the trian2le. * i # .ounter for the num. of charcters to print in each row
* s+ip# , fla2 for chec+in2 whether to * * *A int trian2le(int nos, int i, int s+ip) { char prnt # @*@; int s, 1; for (s # nos; s ># $; s&&) { printf(" ) for (1 # $; 1 <# i; 1%%) { if (s+ip ;# *) { if (i ## 4 "" 1 ## $) { continue; ) ) printf("!'c", prnt); ) return *; ) "); s+ip a character in a row.
int main() { int i, nos # 4; for (i # $; i <# 7; (i # i % ')) { trian2le(nos, i, *); nos&&; printf("(n"); ) nos # 5; for (i # $; i <# 4; i%%) { trian2le($, i, *); AAone space needed in each case of the formation trian2le(nos, i, $); AAs+ip printin2 one star in the last row. nos # nos & '; printf("(n"); ) nos # $; for (i # 3; i ># $; i&&) { trian2le($, i, *); trian2le(nos, i, *); nos # nos % '; printf("(n"); ) nos # $; for (i # 7; i ># $; (i # i & ')) { trian2le(nos, i, *); nos%%; printf("(n"); ) return *; )
* * * * * * * * * * * * * * * * * * * * * * * * *
Program0
#include
A* * nos # Ium. of spaces reDuired in the trian2le. * i # .ounter for the num. of characters to print in each row
int trian2le(int nos, int i, int s+ip) { char prnt # @*@; int s, 1;
for (s # nos; s ># $; s&&) { printf(" ) for (1 # $; 1 <# i; 1%%) { (i ## $ JJ i ## 9) { prnt); ) else { if (s+ip ;# *) { if (i ## 9 "" 1 ## $) { continue; ) ) if ");
printf("!'c",
printf("
# &$; for (i # 9; i ># $; (i # i & ')) { trian2le(nos, i, *); trian2le(nosp, i, $); trian2le(nbsp, i, $); printf("(n"); nos%%; nosp # nosp % '; nbsp # nbsp % '; ) nos # 3, nosp # 5, nbsp # 5; for (i # 3; i <# 9; (i # i % ')) { trian2le(nos, i, *); trian2le(nosp, i, $); trian2le(nbsp, i, $); printf("(n"); nos&&; nosp # nosp & '; nbsp # nbsp & '; )
return *; )
&ownload Code +ac# to top
(et Shareaholic
A!out the Author0 ,his post was written !" 7tsav +aner.ee. <ou can reach 7tsav on email at )ugitivelandMgmail.com
,agged asNN
o o o
&is-us
Share
Post as O $ma%e
A$i#e
o o o o
PPgovernment Arts college Ari"alur tamil nadu QincludeRstdio.hS void main23 T int i . # nD clrscr23D print)2UEnter the n valueVnU3D scan)2UWdU Xn3D )or2iC6DiRCnDiEE3 T )or2.CiD.S6D.553 T print)2U U3D Y )or2#Cn5iD#SCBD#553 T print)2U1U3D Y print)2UVnU3D Y getch23D YRPstdio.hS
o o o o o o
o o o o o
QincludeRstdio.hS void main23 T char sC*1*D int i . # l m nD clrscr23D print)2UEnter the valueVnU3D scan)2UWdU Xn3D )or2iC6DiRC241n3DiEE3 T )or2.C241n3D.SiD.553 print)2U U3D
)or2#CiD#SC6D#553 print)2UW4cU s3D )or2lC4DlRCiDlEE3 print)2UW4cU s3D print)2UVnU3D Y )or2iC41n56DiSBDi553 T )or2.C241n3D.SiD.553 print)2U U3D )or2#C6D#RCiD#EE3 print)2UW4cU s3D )or2lC4DlRCiDlEE3 print)2UW4cU s3D print)2UVnU3D Y getch23D YRPstdio.hS
o o o o o o
1 11 111 11 1
o o o o o
QincludeRstdio.hS main23 T int i . # nD print)2how man" lines "ou want to enter0U3D scan)2UWdU Xn3D )or2iC6DiRCnDiEE3 T )or2.CnD.SCiD.553 T print)2U U3D Y )or2#C6D#RCi56D#EE3 T print)2U1U3D print)2U U3D Y print)2UVnU3D Y )or2iC6DiRCnDiEE3 T )or2.C6D.RCi56D.EE3 T print)2U U3D Y )or2#CnD#SCiD#553
o o o o o o
o o o o o
aC!C?P4E6DPPnCno o) rows..nE2n563C?2)or : rows3 )or2int iC6DiRC:DiEE3 T )or2int .C6D.RC?D.EE3 T i)2.SCaXX.RC!3 print2U1U3D Y a55D !EED Y Y
o o o o o o
o o o o o
Qinclude Qinclude void main23 T int i . nD clrscr23D print)2UEnter n valueU3D scan)2UWdU Xn3D )or2iCnDiSBDi553 T )or2.C6D.RCiD.EE3 T print)2U1U3D Y print)2UVnU3D Y getch23D Y
o o o o o
o o o o o
o o o o o
how can i print *11*s )our sides o) screen8888 example li#e this............ 111111111111111111111111111111111111111111111111111111111111111111111111 11 11 11 11 11 11 11 11 11 11 1111111111111111111111111111111111111111111111111111111111111111111111111
o o o o o
can 7 give "our Email id I /ill Send u program solution !5coF content not %it on it ,r"...........
o o o o o o
int )irstZtermC6D
void main23 T
int a[6BB\[6BB\D int cC6 iCB .CB #CB mCB nCB xCBD
clrscr23D print)2UEnter 'ows and columns )or the s-uare matrix VnU3D scan)2UWdU Xn3D xCnD while2nSC63 T )or2#CBD#RnD#EE3 elseTa[#Em\[n56Em\CUBDYU elseTa[m\[#Em\CUBDYU )or2#CU6D#XltDnD#EE3U i)2)irstZterm3Ta[#Em\[n56Em\CUcEEDYU i)2)irstZterm3Ta[m\[#Em\CUcEEDYUSCBD#553 i)2)irstZterm3Ta[n56Em\[#Em\CcEEDY elseTa[n56Em\[#Em\CBDY
)or2iCBDiRxDiEE3 U3DYCUU DYCUU elseTprint)2UCUU )or2.CUBD.XltDxD.EE3U getch23DCUU i)2a[i\[.\CUCB3Tprint)2UU print)2UVnU3DCUU TCUU YCUU CUU 1U3CUUSRPxDiEE3SRPnD#EE3S
o o o o
o o
B $i#e %
o o o o o o
int )irstZtermC6D
void main23 T int a[6BB\[6BB\Dint cC6 iCB .CB #CB mCB nCB xCBDclrscr23D print)2UEnter the num!er o) rows and columns )or the s-uare matrix VnU3Dscan)2UWdU Xn3DxCnDRPstdio.hSRPconio.hS
o o o o o o
Hi Hari
Code0
Qinclude Rconio.hSQinclude Rstdio.hSint )irstZtermC6Dvoid main23Tint a[6BB\[6BB\Dint cC6 iCB .CB #CB mCB nCB xCBDclrscr23Dprint)2UEnter the num!er o) rows and columns )or the s-uare matrix VnU3Dscan)2UWdU Xn3DxCnDwhile2nSC63T)or2#CBD#RnD#EE3i)2)irstZterm3Ta[m\[#Em\CcEEDYelseTa[m\ [#Em\CBDY)or2#C6D#RnD#EE3i)2)irstZterm3Ta[#Em\[n56Em\CcEEDYelseTa[#Em\[n56Em\CBDY)or2#Cn54D#SCBD#553i)2)irstZterm3Ta[n56Em\[#Em\CcE EDYelseTa[n56Em\[#Em\CBDY)or2#Cn54D#SBD#553i)2)irstZterm3Ta[#Em\[m\CcEEDYelseTa[#Em\[m\CBDYi)2xCCn3T)irstZtermCBDYn5C4DmEEDY)or2iCBDiRxDiE E3T)or2.CBD.RxD.EE3T U3DY CUU DYYprint)2UVnU3DYgetch23DYCUU elseTprint)2UCUU i)2a[i\[.\CUCB3Tprint)2UU CUU 1U3CUUSRPxDiEE3T)or2.CBD.RxD.EE3T SRPnD#E E3i)2)irstZterm3Ta[m\[#Em\CcEEDYelseTa[m\[#Em\CBDY)or2#C6D#RnD#EE3i)2)irstZterm3Ta[#Em\[n56Em\CcEEDYelseTa[#Em\[n56Em\CBDY)or2#Cn5 4D#SRPstdio.hSRPconio.hS
o o o o o o
o o o o o o
void main23 T )or2int iC6DiRCnDiEE3PPn is an" integer value )or2int .C6D.RCnD.EE3 i)2iCC6]]iCCn]].CC6]].CCn3 print2U1U3D Y
o o o o o o
plF someone tell me program )or )ollowing output 11 1111 111111 11111111 1111111111 11111111 111111 1111 11
o o
A$i#e 'epl"
o o o
QincludeRstdio.hS
space C n 5 6D
space55D
print)2UVnU3D
space C 6D
spaceEED
print)2UVnU3D Y
return BD YRPstdio.hS
o o o o o o
6 49 :=> ? @ A 6B
o o o o o
QincludeRstdio.hS void main23 T int i . aC6D )or2iC6DiRC:DiEE3 T )or2.C6D.RiE6D.EE3R!rS T print)2UWdU a3D aEED Y print)2UVnU3D Y getch23D YRPiE6D.EE3R!rSRPstdio.hS
o o o o o o
A$i#e 'epl" > months ago in repl" to supantha #umar pal 4 $i#es %
QincludeRstdio.hS void main23 Tint i . tempCBD clrscr23D )or2iCBDiRnDiEE3 )or2.CUBD.XltDnD.EE3U print)2UWdU temp3DCUU tempEEDCUU TCUU YCUUSRPnDiEE3SRPstdio.hS
o o o o o o
QincludeRstdio.hS
return BD YRPstdio.hS
o o o o o o
o o o o o o
great
o o o o o
o o o o
to print as 111 11 1
o o o o o
give me the code o) )ollowing character A + C & E % ( % E & C + A A+C&E%%E&C+A A+C&EE&C+A A+C&&C+A A+CC+A A++A AA
o o o o o
QincludeRstdio.hS QincludeRconio.hS void main23 int i . # l aC6 dC4 xD char pC*A*D )or2iC6DiRC>56DiEE3 T )or2.C6D.RC?5iD.EE3 T print)2UWcU p3D pEED Y xCaE2i5631dD )or2#C6D#RCxD#EE3 T print)2U U3D Y )or2lC6DlRC?5iDlEE3 T print)2UWcU p563D p55D Y print)2UVnU3D Y getch23D Y
RPconio.hSRPstdio.hS
o o
A$i#e 'epl"
o o o o
please can "ou provide the code )or )ollowing pattern in CEE
its a little distorted !ut "ou must have understood what i am tr"ing to printcan mail me at S7&HI'6:?@AMgmail.com
o o o o o
QincludeRstdio.hS void main23 T print)2UH H EEEEE $ $ OOOOH H E $ $ O OH H E $ VnU3D print)2U $ O OHHHHH EEEEE $ $ O OH H E $ $ O OHVnU3D print)2U H E $ $ O OH H EEEEE $$$$$ $$$$$ OOOOOVnU3D YRPstdio.hS
o o o o o o
plF tell me coding 111111 and send me code on m" email5id 1 1 m" id smileZrashmichar.anMredi)).com 11 111111
o o o o o
i need simple c program to print li#e a )ollowing pattern 1 111 11111 111 1
o o o o o
class pattern46st T pu!lic static void main 23 T )or2int i C 6 D i RC= D iEE3 T )or2int . C 6 D . RC i D .EE3 T S"stem.out.print2 U1U E U U 3D Y S"stem.out.println23D Y )or2int i C : D i SC6 D i553 T )or2int . C 6 D . RC i D .EE3 T S"stem.out.print2 U1U E U U 3D Y S"stem.out.println23D Y Y Y
o o o o o o
o o
A$i#e 'epl"
o o o o
o o o o o
o o o o o
11111
o o o o o
o o o o o
11 11 1 11 11
o o o o o
o o o o o o
QincludeRstdio.hS QincludeRconio.hSint main23T int i . # lD )or2iCBDiRC4DiEE3 T print)2UVnVnU3D )or2#CBD#RC6D#EE3 print)2U1 U3D Y print)2UVnVn1U3D )or2.CBD.RC4D.EE3 T print)2UVnVnU3D )or2lCBDlRC6DlEE3 print)2U1 U3DY getch23D YRPconio.hSRPstdio.hS
o o o o o o
o o o o o
QincludeRstdio.hSQincludeRconio.hS int main23 T int i . # lD )or2.CBD.RC=D.EE3 print)2U1U3D )or2iCBDiRC4DiEE3 T print)2UVnVnU3D )or2#CBD#RC6D#EE3 print)2U1 U3D Y print)2UVnVnU3D )or2lCBDlRC=DlEE3 print)2U1U3D getch23D YRPconio.hSRPstdio.hS
o o o o o
plF help mi to write ths pattern program.. 11111111111111111 11 11 111111 111111 611 11 1111 1111 11 11111111111
o o o o o
1 11 11 111111
o o o o o
@ /rite a separate algorithm )or a program to output each o) the )ollowing patterns [Gote0 ,here are )our triangles o) stars la!elled 2a3 2!3 2c3 2d3. Each triangle consists o) ten lines o) stars. Starting )rom line 6 to 6B the num!er o) stars either increases !" 6 )rom 6 to 6B or decreases !" 6 )rom 6B to 6\0
2a3 2!3 2c3 2d3 1 1111111111 1111111111 1 11 111111111 111111111 11 111 11111111 11111111 111 1111 1111111 1111111 1111 11111 111111 111111 11111 111111 11111 11111 111111 1111111 1111 1111 1111111 11111111 111 111 11111111 111111111 11 11 111111111 1111111111 1 1 1111111111
o o o o o
As the author o) the post I would li#e to re-uest ever"one not to as# )or read" made codes as I am strictl" against spoon )eeding. Please tr" out the pro!lem "oursel) post "our code in paste!in.com n re)er us the lin# so that we can veri)" "our code and help "ou solve the riddle.
o o o o o
o o o o o
QincludeRstdio.hS void main23 T int i . aC6D )or2iC6DiRC:DiEE3 T )or2.C6D.RiE6D.EE3 aEEDCUU getch23DCUU print)2UWdU a3DCUU print)2UVnU3DCUU TCUU YCUU YCUU CUUSRPiE6D.EE3SRPstdio.hS
A$i#e
o o o o o
,he credit o) this post goes to 7tsav +aner.ee.. (ood wor# 7tsav; Editor Interview Mantra
o o o o o
o o o o o
o o o o o
1 11 11 1
o o o o o
QincludeRstdio.hS void main23 T int i . # l m nD char x[6B\CUa!cde)gUD clrscr23D nCstrlen2x3D )or2iCBDiRnDiEE3 )or2.CUBD.XltDCiD.EE3U )or2#CUnD#U print)2UWcU x[.\3DCUU TCUU YCUUSiE6D#553 T print)2U U3D Y )or2lCn56DlSiE6Dl553 T print)2U U3D Y )or2mCiDmSCBDm553 T i)2mCCn563 continueD print)2UWcU x[m\3D Y print)2UVnU3D
Y getch23D YRPnDiEE3SRPstdio.hS
o o o o o o
P$^ 'EP$< .
o o o o o
1 11 11 1 11 11 1
o o o o o
o o o o o
char x[6BB\D int i n . a #D clrscr23D print)2UEnter the stringVnU3D gets2x3D nCstrlen2x3D )or2iCBDiRnDiEE3 U3DCUU )or2aCUiDaXltDn56DaEE3U )or2.CUiD.U TCUU CUU print)2UCUUSCBD.553 print)2UWcU x[.\3D )or2#C6D#RCiD#EE3 print)2UWcU x[#\3D print)2UVnU3D
Y )or2iCn54DiSCBDi553 T )or2aCn5i56DaSBDa553 print)2U U3D )or2.CiD.SCBD.553 print)2UWcU x[.\3D )or2#C6D#RCiD#EE3 print)2UWcU x[#\3D print)2UVnU3D Y
getch23D YRPnDiEE3SRPstdio.hS
o o o o o o
an" !od" #now the program please repl" me. i attend one interview second round execution round as#ing this t"pe o) output.....i tr" !ut i can not give correct output. so i re.ected that interview
o o o o o
PPmaventic in)otech QincludeRstdio.hS void main23 T char sC*1*D int i . # l m nD clrscr23D print)2UEnter the valueVnU3D scan)2UWdU Xn3D )or2iC6DiRC241n3DiEE3 T )or2.C241n3D.SiD.553 T print)2U U3D Y )or2#CiD#SC6D#553 T i)2iRCn3 print)2UW4cU s3D else T mC#5nD i)2mSC63 print)2UW4cU s3D else print)2U U3D Y Y )or2lC4DlRCiDlEE3 T
i)2iRCn3 print)2UW4cU s3D else T mCl5nD i)2mRCB3 print)2U U3D else print)2UW4cU s3D Y Y print)2UVnU3D Y )or2iC41n56DiSBDi553 T )or2.C241n3D.SiD.553 print)2U U3D )or2#C6D#RCiD#EE3 T i)2iRCn3 print)2UW4cU s3D else T mCi5#D i)2mSCn3 print)2UW4cU s3D else print)2U U3D Y Y )or2lC4DlRCiDlEE3 T i)2iRCn3 T print)2UW4cU s3D Y
else T mCl5nD i)2mRCB3 print)2U U3D else print)2UW4cU s3D Y Y print)2UVnU3D Y getch23D YRPstdio.hS
o o o o o o
o o o o o
i want the coding o) this pattern 6 464 94649 :94649: =:94649:= :94649: 94649 464 6
o o o o o
int i n . a #D
clrscr23D print)2UEnter the num!erVnU3D scan)2UWdU Xn3D )or2iC6DiRCnDiEE3 T )or2aCiDaRnDaEE3 U3DCUU )or2.CUiD.U CUU print)2UCUUSC6D.553 print)2UWdU .3D )or2#C4D#RCiD#EE3 print)2UWdU #3D print)2UVnU3D
Y )or2iCn56DiSBDi553 T )or2aCn5iDaSC6Da553 print)2U U3D )or2.CiD.SBD.553 print)2UWdU .3D )or2#C4D#RCiD#EE3 print)2UWdU #3D print)2UVnU3D Y
getch23D YRPnDaEE3SRPstdio.hS
o o o o o o
4.
int i . cnt max #D # C BD max C 6BD )or2. C BD . R :D .EE3 T )or2i C BD i RC maxD iEE3 T i)22i RC #3 ]] 2i SC2max 5 #333 T print)2U1U3D Y else T print)2U U3D Y print)2U U3D Y print)2UVnU3D # C # E 4D Y
return BD Y RPstdli!.hSRPstdio.hS
o o o o o
o o o o o
plF tell me the code )or 1111111 1111111 111 1 111 1111111
o o o o o
o o o o o o
11
1111
11
11111111
11
1111
11
o o o o o
> =: 946
o o o o o
o o o o o o
please giv me the code )or )ollowing pattern; 6 66 46 6466 666446 964466 69664446
o o o o o
/ould someone !e a!le to help with creating a hollow triangle in Java loo#ing li#e this0 555515555555151555551555155515555515111111111 /here the 5 e-uals a space. A user enters a num!er and the triangle height C the num!er. I have this code so )ar !ut I can*t get an" )urther. Got even sure i) I*m on the right trac# an"more0 http0PPpaste!in.comPr7rJaH/= ,han#s in advance.
o o o o o
o o o o o o
o o
A$i#e 'epl"
o o o
thanx dear
o o o o o
so di)) to get;;;
o o o o o
please give me help )or printing !elow pattern. i) inputn is = then 6 4 9 : =6> 6? 6@ 6A > 6= 4: 4= 4B ?
6: 49 44 46 @ 69 64 66 6B A
o o o o o
o o o o o
Program 0
QincludeRstdio.hS
int main2void3
int lCB iD
clrscr23D
print)2Uenter a stringU3D
scan)2UWsU Xst3D
)or2iCBDiRlDiEE3 XCUU 1toCUU 4CUU DCUU aCUU !rea#CUU !rea#D CUU !unn"CUU compareCUU elseCUU enterCUU )or2iCUBDiXltDlDiEE3U i)2iCUCl3 U i)2st[i\;CUrev[i\3 U input CUU lengthsCUU loop1CUU madamCUU notCUU o)CUU originalCUU output0CUU palindromeCUU palindromeU3DCUU print)2UnotCUU print)2UpalindromeU3DCUU rev[i\CUst[l5i56\D U rev[l\CUVBU reverseCUU reversedCUU srings1CUU stringCUU string1CUU theCUU TCUU YCUU CUU CUU CUU CUUSRPlDiEE3SRPstdio.hS
o o o o o o
QincludeRstdio.hS void main23 T int rCB x " FD print)2UEnter the num!er to !e chec#ed U3D scan)2UWdU Xx3D
"CxD while 2x;CB3 T rC2r16B3E2xW6B3D xCxP6BD FCrD Y i) 2"CCF3 T print)2Uthe given num!er is a pallindrome.U3D Y else T print)2Uthe given num!er is not a pallindrome.U3D Y YRPstdio.hS
o o o o o o
this is not the optimiFed code this will use more memor"
o o o o o
o o o o o
class pattern6st T pu!lic static void main 23 T )or2int i C 6 D i RC= D iEE3 T )or2int . C 6 D . RC i D .EE3 T S"stem.out.print2 U1U E U U 3D Y S"stem.out.println23D Y Y Y
o o o o o
QincludeRstdio.hS
print)2UVnU3D Y
YRPstdio.hS
o o o o o o
o o o o o
Y print)2UVnU3D
o o o o o o
o o o o o
o o o o o
i have pro!lem in m" codes please sent me and email on asteris# patterns please;;;;;;;;
o o o o o
code to print the )ollowing pattern0 6 696 69=96 69=?=96 69=96 696 6
o o o o o
a!ove is not exact pattern ma" ! some pro!lem in printing the pattern is 0 there is three spaces and then star in )irst line in second line two spaces then star then one space and again star in third line one space one star then three spaces one star in )ourth line seven stars.
o o
A$i#e 'epl"
o o o
o o o o o
6666666 6446 6996 6:6 6996 6446 6666666 can an" one do this888888888
o o o o o
heloo )riends "our mind is ver" sharp !ecouse "our programing is ver" dilicious
o o o o o
o o o o o
"e s this is per)ect .!ut it will not run properl" so modi)" it now.
o o o o o
PA',ICIPA,E
IG
PO$$
/hat )actor motivates "ou the most at wor#8 Mone" 'espect Jnowledge Appreciation Challenging wor# Other0
'ECEG, EG,'IES o o o o o o o o o o
Secrets o) Success Interview Mantra hits 6 million pageviews mar# = -uestions "ou should as# "oursel) in "our )irst .o! Hans 'osling a Swedish Health Expert admits that Indian students were !etter than him Is there a limit to )ail in .o! interviews8 Campaign to )ight .o! search depression M" admission interview with 'o!ert (ordon 7niversit" Pie Chart o) Indian Jo! mar#et !ased on "ears o) experience Hedic mantra to achieve Success in Jo! Interviews 'easons )or re.ection o) application )or admission to + Schools
C$O7&
,A(
interview -uestionscareercareer
%reshers
)unctionshiring stor"
Humorindiaindian
studentsin)os"sinspirationinterview
SEA'CH
IG
IG,E'HIE/ MAG,'A
'ECEG, COMMEG,S
ParthshahB:9
Poo.aredd""?A
Msri:B6
&eepan.an Mitra
ranga sathish
IG,E'HIE/ MAG,'A
%ACE+OOJ
$nterview &antra
+$O('O$$ o o o o o
Code Explosion Interview Mantra5 India PS& to H,M$ 'oc# Solutions /ant to add "our we!site here8
CA,E(O'IES o
Career Issues 2463
o
Jo! Search depression 243
Education 26B3
C 29>3
o o
CEE 2?3 H' 2A3 Java 26B3
IuiF 263
o o
o ,OP
Posts
Announcements 2463 IMI 2A3 Jo! Gews 2:3 Posts )or email su!scription 2=3 Pu!lic Opinion 293 ,utorials 2>3
/ordPress Admin