Monthly Archives: June 2023

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 »

Loading

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[100]; 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 »

Loading

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[100], str2[100]; 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 »

Loading