Let’s write a JavaScript program to print Even Numbers within a given range. First, to find an Even number it is very simple, divide the
Let’s write a JavaScript program to print Odd Numbers within a given range. First, to find an Odd number it is very simple, divide the
In this post, we are going to see how to write a PHP program to print leap years between two selected years. So basically we
Hi Students, let’s write another pattern program in C language! Print Diamond star pattern using C program:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
#include <stdio.h> int main() { int limit, space, i, j; //print a string about the program printf("C Program to print diamond pattern\n"); printf("Enter the limit: "); //get the limit scanf("%d", &limit); //print the first half of the pyramid space = limit; for (i = 1; i <= limit; i++) { for (j = 1; j <= space; j++) { printf(" "); } space--; for (j = 1; j <= 2 * i - 1; j++) { printf("*"); } printf("\n"); } //print the second half of the pyramid space = 2; for (i = 1; i <= limit; i++) { for (j = 1; j <= space; j++) { printf(" "); } space++; for (j = 1; j <= 2 * (limit - i) - 1; j++) { printf("*"); } printf("\n"); } } |
Sample Output of the above program:
1 2 3 4 5 6 7 8 9 10 11 |
C Program to print diamond pattern Enter the limit: 5 * *** ***** ******* ********* ******* ***** *** * |
Hello reader, here is a Python programme to find an entered number is odd or even. This programme could be useful for cracking interviews or
Let’s see an interesting program for school/college students who are learning core Java. To find whether an entered number is Odd or Even is very
Hello Perl language learners, school/college students here is another interesting program that will help you to understand the basic concepts of Perl CGI Web scripting such as
Let’s write a simple Perl program to find leap year, very useful for beginners and school / college students, Formula for finding a Leap year
Hello C language lovers, school/college students here is another interesting program that will help you to understand the basic concepts of C language such as how to
Hi friends, In this post, we are going to discuss how to print a series of Prime numbers using Core Java. This basic Java program