Posts

Showing posts from July, 2021

Program to convert the given temperature from Fahrenheit(F) to Celsius(C)

Image
  Converting the given Temperature from Fahrenheit(F) to Celsius(C) and converting the given temperature from Celsius(C) to Fahrenheit(F): - _________________________________________ C Program to convert the given temperature from Fahrenheit(F) to Celsius(C): - The program shown below will temperature value in Fahrenheit(F) from the standard input and converts the temperature into Celsius(C). Program: -  #include <stdio.h> void main() { float f, c; printf("Enter F: "); scanf("%f", &f); c = (f - 32) * 5 / 9; printf("C = %f\n", c); } Output: - Enter F : 32.45 C : 0.250000 Fig: Program to convert the given temperature from Fahrenheit(F) to Celsius(C) Note: - Formula to convert the temperature in Fahrenheit(F) to Celsius(C) c = (f - 32) * 5 / 9 and  we use, f = (c * 9 /5) + 32 to convert  temperature from Celsiuse(C) to Fahrenheit(F). _______________________________________________________ C Program to convert the given temperature from  Celsius(C)...

Program to convert an Uppercase character into a Lowercase character and Lowercase character into an Uppercase character.

Image
Converting an Uppercase character into a Lowercase character and a Lowercase character into an Uppercase character: -  _________________________________________ C program to convert an uppercase character into a lowercase character: - The program shown below will read an uppercase character from standard input and convert it into its corresponding lowercase character. Program:- #include <stdio.h> void main() { char ch; printf("uppercase character : "); scanf(" %c", &ch); ch = ch + 32; printf("lowercase character : %c\n", ch); } Output: - uppercase character : D lowercase character : d Fig: Converting an uppercase character into a lowercase character Note: - ASCII values for uppercase alphabets are from 65('A') to 90('Z') and the lowercase alphabets are from 97('a') to 122('z'). Therefore the difference between an uppercase and lowercase character is 32, adding 32 to the uppercase character will give its correspondi...

Program to find Sum and Average of three Numbers

Image
Sum and Average Of 3 Numbers : C Program to find the sum and average of given three numbers:- Here in this blog post, let us discuss how to write a basic C program to find the sum and average of  3 numbers.  This post includes the two different programs to find the sum and average for integer values and for the float values. Program to find the Sum and average of 3 given integer values:- The below is a Data input and output program which takes the given input from the console and performs the operation and then prints the output to the console. Program: - #include <stdio.h> void main() { int num1, num2, num3; int sum, avg; printf("Enter three integer values : "); scanf("%d %d %d", &num1, &num2, &num3); sum = num1 + nnum2 + num3; printf("sum of %d, %d and %d  : %d\n", num1, num2, num3, sum); avg = sum / 3; printf("Average of %d, %d and %d : %d\n", num1, num2, num3, avg); } Output: - Enter three integer values : 40 20 30 sum of 40...