C Program to Count Vowels and Consonants in a String using Pointer

  #include <stdio.h> int main() { char str[100]; char *p; int vCount=0,cCount=0; printf(“Enter any string: “); fgets(str, 100, stdin); //assign base address of char array to pointer p=str; //’\0′ signifies end of the string while(*p!=’\0′) { if(*p==’A’ ||*p==’E’ ||*p==’I’ ||*p==’O’ ||*p==’U’ ||*p==’a’ ||*p==’e’ ||*p==’i’ ||*p==’o’ ||*p==’u’) vCount++; else cCount++; //increase the pointer, to point next … Read more

C Program to Print String using Pointer

#include <stdio.h> int main() { char str[100]; char *p; printf(“Enter any string: “); fgets(str, 100, stdin); /* Assigning the base address str[0] to pointer * p. p = str is same as p = str[0] */ p=str; printf(“The input string is: “); //’\0′ signifies end of the string while(*p!=’\0′) printf(“%c”,*p++); return 0; }  

Anna University December Exam Results Soon. Here’s How To Check

ctet result 2019

Anna University December Exam Results Soon. Here’s How To Check Anna University result 2019: Anna University will release the December and January examinations’ results soon. According to an official, the Anna University results for the examinations held recently will be released by the end of this week. However, the university official has not specified an exact date … Read more

C Program to Check Whether a Number is Prime or Not

Program to Check Prime Number #include <stdio.h> int main() { int n, i, flag = 0; printf(“Enter a positive integer: “); scanf(“%d”, &n); for (i = 2; i <= n / 2; ++i) { // condition for non-prime if (n % i == 0) { flag = 1; break; } } if (n == 1) … Read more

C program to convert Celsius to Fahrenheit using while loop

To convert Celsius to Fahrenheit #include <stdio.h> #include <stdlib.h> int main() { float celsius, fahrenheit; printf(“\nEnter temperature in celsius: “); scanf(“%f”, &celsius); fahrenheit = (1.8) * celsius + 32; printf(“\n%f deg celsius is %f fahrenheit\n”, celsius, fahrenheit); return 0; }  

C Program to Make a Simple Calculator Using switch case

Simple Calculator using switch Statement #include <stdio.h> int main() { char operator; double first, second; printf(“Enter an operator (+, -, *,): “); scanf(“%c”, &operator); printf(“Enter two operands: “); scanf(“%lf %lf”, &first, &second); switch (operator) { case ‘+’: printf(“%.1lf + %.1lf = %.1lf”, first, second, first + second); break; case ‘-‘: printf(“%.1lf – %.1lf = %.1lf”, … Read more

C Program to Find the Size of int, float, double and char

Program to Find the Size of Variables #include<stdio.h> int main() { int intType; float floatType; double doubleType; char charType; // sizeof evaluates the size of a variable printf(“Size of int: %ld bytes\n”, sizeof(intType)); printf(“Size of float: %ld bytes\n”, sizeof(floatType)); printf(“Size of double: %ld bytes\n”, sizeof(doubleType)); printf(“Size of char: %ld byte\n”, sizeof(charType)); return 0; }

C Program to Multiply Two Floating-Point Numbers

Program to Multiply Two Numbers #include <stdio.h> int main() { double a, b, product; printf(“Enter two numbers: “); scanf(“%lf %lf”, &a, &b); // Calculating product product = a * b; // Result up to 2 decimal point is displayed using %.2lf printf(“Product = %.2lf”, product); return 0; }