# Monthly Archives: June 2023

## Python Program Print Hollow Heart of Stars

Python Program Print Hollow Heart of Stars – This is a Python program that will print a Hollow Heart of stars.   Source Code n = 6 for row in range(n): for col in range(n+1): if (row == 0 and col % 3 != 0) or (row == 1 and col % 3 == 0)… Read More » ## Hollow Square of Stars Printing Python Program

Hollow Square of Stars Printing Python Program – This program will print a hollow square of stars in Python programming language. Here’s a Python program to print a hollow square: n = 5 for i in range(n): if i == 0 or i == n – 1: print(‘*’ * n) else: print(‘*’ + ‘ ‘… Read More » ## Print Hollow Triangle of Stars in Python

Print Hollow Triangle of Stars in Python – Write a python program to print hollow triangle of the stars. Source code n = 5 for i in range(1, n+1): if i == 1 or i == n: print(‘*’ * i) else: print(‘*’ + ‘ ‘ * (i-2) + ‘*’) Explanation Let us understand how this… Read More » ## Print Inverted Pyramid of Numbers Python Program

Print Inverted Pyramid of Numbers Python Program – This program will show am inverted pyramid of numbers as shown below: Source Code n = 5 num = n for i in range(n, 0, -1): print(‘ ‘ * (n – i) + ‘ ‘.join(str(num) * i)) num -= 1 ## Print Inverted Pyramid of Stars in Python

Print Inverted Pyramid of Stars in Python – Write a Python program to display inverted pyramid of stars.   Source Code n = 5 for i in range(n, 0, -1): print(‘ ‘ * (n – i) + ‘*’ * (2 * i – 1)) ## Check Palindrome String C Program

Check Palindrome String C Program – Input a string and check whether this string entered by the user is a Palindrome or Not. Source Code #include <stdio.h> #include <string.h> int main() { char str; int i,size,palindrome=1; printf(“Enter the string : “); gets(str); size=strlen(str); for(i=0;i<size/2;i++) { if(str[i]!=str[size-i-1]) { palindrome=0; break; } } if(palindrome==1) printf(“%s string is… Read More » ## Count Words in String C Program

Count Words in String C Program – Write down a C program to input a string and find the number of words in it. Source Code #include <stdio.h> void main() { char str; int wordcount=1, i=0; printf(“Enter a string to count No. of words :\n”); fgets(str, 100, stdin); while(str[i]!=’\0′) { if(str[i]==’ ‘ || str[i]==’\n’ ||… Read More » ## Count Digits in String C Program

Count Digits in String C Program – Input a string containing both digits and alphabets. This program in C language will display the count of digits in the given string. Source Code /* * C program to count the digits present in the given string */ #include <stdio.h> void main() { char str; int i,count=0;… Read More » ## C String Program Remove Blank Spaces

C Program Remove Blank Spaces from a given string entered by the user at run time. Code /* C Program to removing blank spaces from string easyCodeBook.com */ #include <stdio.h> int main() { char str1, str2; int i, j, size = 100; printf(“Enter a string to remove spaces:\n”); gets(str1); j=0; for(i=0; str1[i] != ‘\0’; i++)… Read More » 