In this post, we are going to write a simple C program to find the ASCII value of any character that a user has entered.
Category: C Programming

In this post, let see how to print two float numbers using C language. This program is useful for school & college students and those

In this post, I am going to write a C program to print ‘Odd numbers’ from 1 to N. First I need to get the

In this post, I am going to write a C program to print ‘even numbers’ from 2 to N. To do that, first I need

Let’s write a simple C program to generate multiplication table. It’s fairly a simple program. Here is a Short snippet to generate 7 times tables:

In this post, we are going to write a C program to print leap years between two given years. So basically we need to collect

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 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

In this post we are going to write a simple C program to print alphabets, both Capital letter alphabets and Small letter alphabets. It’s not

In this post we are going to write a C program to calculate the “Area of square”. Formula for calculating “Area of square” is, Area