Interesting C number pattern
Page 1 of 1
Interesting C number pattern
Guys,
If you are interested in C programming, this post really for you...
Here I'm going to share a link basically. Here you will found lots of solved problem with explanation. Hope you'll enjoy it.
It's a blog edited by one of my friend who lives in India. His name is Sridhar Jammalamadaka. He is a professional blogger from Pune. He is an experienced programmer
with expertise in Java, C and Micro Controller programming. By the way, you will find there some interesting post, like
1. different C question and and answer with explanation
2. C solved program
3. C puzzle
and additionally you can find educational material related to Jobs and Interviews. You
can also find technical articles on Software technologies such as C
language, Java and Flex.
this blog is very much helpful for IT freshers.
So guys, Have a look ...
CLICK HERE
Lets see a pattern -
and output will be :
Cheers !!
If you are interested in C programming, this post really for you...
Here I'm going to share a link basically. Here you will found lots of solved problem with explanation. Hope you'll enjoy it.
It's a blog edited by one of my friend who lives in India. His name is Sridhar Jammalamadaka. He is a professional blogger from Pune. He is an experienced programmer
with expertise in Java, C and Micro Controller programming. By the way, you will find there some interesting post, like
1. different C question and and answer with explanation
2. C solved program
3. C puzzle
and additionally you can find educational material related to Jobs and Interviews. You
can also find technical articles on Software technologies such as C
language, Java and Flex.
this blog is very much helpful for IT freshers.
So guys, Have a look ...
CLICK HERE
Lets see a pattern -
- Code:
#include
int main(void) {
int i, j, k, s, p, q, sp, r, c = 1, nos = 13;
for (i = 1; c <= 4; i++) {
if ((i % 2) != 0) { // Filters out the even line nos.
for (j = 1; j <= i; j++) { // The upper left triangle
printf("%2d", i);
}
for (s = nos; s >= 1; s--) { // The spacing factor
printf(" ");
}
for (k = 1; k <= i; k++) { // The upper right triangle
printf("%2d", i);
}
printf("\n");
nos = nos - 4; // Space control
++c;
}
}
nos = 10; // Space control re intialized
c = 1;
for (p = 5; (c < 4 && p != 0); p--) {
if ((p % 2) != 0) { // Filters out the even row nos
for (q = 1; q <= p; q++) { // Lower left triangle
printf("%2d", p);
}
for (sp = nos; sp >= 1; sp--) { // Spacing factor
printf(" ");
}
for (r = 1; r <= p; r++) { // Lower right triangle
printf("%2d", p);
}
printf("\n");
--c;
nos = nos + 8; // Spacing control.
}
}
return 0;
and output will be :
Cheers !!
Similar topics
» Design Pattern study material: Composite Pattern
» Interesting for loop
» Interesting loop
» Interesting java code
» Interesting Java code
» Interesting for loop
» Interesting loop
» Interesting java code
» Interesting Java code
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Tue Sep 29, 2015 2:45 pm by Sophiawood
» Cisco EHWIC SFP/GE WAN Card
Mon Sep 07, 2015 11:08 am by Sophiawood
» Huawei S1700-28GFR-4P-AC Price
Thu Jun 25, 2015 2:31 pm by Sophiawood
» teach yourself C++ / Herbert Schildt Solutions
Wed Jun 03, 2015 1:52 pm by Abdullah Al Noman
» teach yourself c by herbert schildt pdf
Wed May 13, 2015 11:01 pm by Raquib Ridwan
» ASA 5506X With Firepower ASA5506-K9
Fri Apr 10, 2015 4:31 pm by Sophiawood
» New Trends in Deal Business
Tue Feb 03, 2015 9:38 pm by nersoa
» PoE Power Allocation for WS-C2960S-24PS-L
Wed Nov 05, 2014 11:12 am by Sophiawood
» How to cure back pain
Fri Oct 31, 2014 7:15 pm by Bergen Guildford