C Program to find the Sum of First n Natural numbers using for loop

C Program to find the Sum of First n Natural numbers

C Program to find the Sum of First n Natural numbers using for loop   #include <stdio.h> int main() { int n, count, sum = 0; printf(“Enter the value of n(positive integer): “); scanf(“%d”,&n); for(count=1; count <= n; count++) { sum = sum + count; } printf(“Sum of first %d natural numbers is: %d”,n, sum); … Read more

C Program to Check Whether a Character is Vowel or Consonant

c program for vowel and consonent

C Program to Check Whether a Character is Vowel or Consonant The five alphabets A, E, I, O and U are called vowels. All other alphabets except these 5 vowel letters are called consonants.   #include <stdio.h> int main() { char c; int isLowercaseVowel, isUppercaseVowel; printf(“Enter an alphabet: “); scanf(“%c”,&c); // evaluates to 1 (true) … Read more