Monthly Archives: March 2020

C Program Convert String Lower Case

C Program Convert String Lower Case /* C Program to convert given string into lower case */ #include <stdio.h> #include <string.h> int main() { char str[100]; printf(“Please, input a string to convert to lower case\n”); gets(str); printf(“The string in lower case is: %s\n”, strlwr(str)); return 0; } Output Please, input a string to convert to… Read More: C Program Convert String Lower Case »

Loading

C Program Find String Length

C Program Find String Length /* C program to calculate and print length of given string without using built-in function. */ #include<stdio.h> #include<string.h> int main() { int i,length; char str[100]; printf("Enter a String to find its length:"); gets(str); i=0; while(str[i]!='\0') i++; printf("Using own code, The length of string '%s' is = %d",str,i); printf("\nUsing Predefined Function… Read More: C Program Find String Length »

Loading

C Program Sum Factorial Series

C Program Sum Factorial Series /* C program to calculate and print sum of the series 1!+2!+3!+…+n! C program to print the sum of factorials of natural numbers from 1 to n. */ #include<stdio.h> int main() { int i,n,sum; long fact=1; printf(“Enter the value of n: “); scanf(“%d”,&n); sum=0; /* loop to calculate sum from… Read More: C Program Sum Factorial Series »

Loading

C Program Check Palindrome Number

C Program Check Palindrome Number #include <stdio.h> int main() { int n, reverseNum, lastDigit, num; printf(“Enter a number : “); scanf(“%d”,&num); n = num; reverseNum = 0; while(n > 0) { lastDigit = n % 10; reverseNum = (reverseNum * 10) + lastDigit; n = n / 10; } if(num == reverseNum) printf(“\n%d is a… Read More: C Program Check Palindrome Number »

Loading

C Program Sum Series N Natural Numbers

C Program Sum Series N Natural Numbers /* C program to calculate and print sum of the series 1+2+3+4+…+n C program to print the sum of all natural numbers from 1 to n. */ #include<stdio.h> int main() { int i,n,sum; printf(“Enter the value of n: “); scanf(“%d”,&n); sum=0; /* loop to calculate sum from 1… Read More: C Program Sum Series N Natural Numbers »

Loading

C Program Sum of One to N by Recursion

C Program Sum of One to N by Recursion /*C Program To Add all natural numbers 1 to N Using Recursion */ #include <stdio.h> /* Function prototype */ int sumNumbers(int n); /* main function */ int main() { int num; printf(“Enter a positive integer\nto add all numbers upto: “); scanf(“%d”, &num); printf(“Sum of Numbers Upto… Read More: C Program Sum of One to N by Recursion »

Loading

C Program Sum of Digits by Recursion

C Program Sum of Digits by Recursion Output: Please, Enter a number to calculate sum of digits by Recursion: 567 Using Recursion, Sum of digits of 567 = 18 C Program to calculate Sum of Digits of a given number. /** ** C program to find sum of digits using recursive function */ #include <stdio.h>… Read More: C Program Sum of Digits by Recursion »

Loading