C program to print diamond pattern

C Programming Tutorial

C program to print diamond pattern #include <stdio.h> int main() { int i, j, rows, space = 1; printf(“Please enter number of rows you want to see in half Diamond\n”); scanf(“%d”, &rows); printf(“Diamond pattern:\n”); space = rows – 1; for (j = 1; j <= rows; j++) { for (i = 1; i <= space; … Read more

Sorting program in c

c program to sort array

Sorting program in c /* * C program to accept N numbers and arrange them in an ascending order */ #include <stdio.h> void main() { int i, j, a, n, number[30]; printf(“Enter the value of N \n”); scanf(“%d”, &n); printf(“Enter the numbers \n”); for (i = 0; i < n; ++i) scanf(“%d”, &number[i]); for (i … Read more