Skip to main content

Featured

C Pattern Programs: Square Number and Alphabet Patterns Explained

πŸ”· Square Star Pattern πŸ“‹ Copy Code #include <stdio.h> int main() { int num; printf("Enter the number:\n"); scanf("%d", &num); for(int i = 1; i <= num; i++) { for(int j = 1; j <= num; j++) { printf("* ");//keep"* " } printf("\n"); } return 0; } πŸ”· Reverse Square Alphabet Pattern (Column-wise) πŸ“‹ Copy Code #include <stdio.h> int main() { int num; printf("Enter the number:\n"); scanf("%d", &num); for(int i = num; i >= 1; i--) { for(int j = num; j >= 1; j--) { printf("%c ", j + 64);//%c for Character and 64 will be ASIIC VALUE } printf("\n"); } return 0; } πŸ”· Reverse Square Alphabet Pattern (Row-wise) πŸ“‹ Copy Code #include <stdio.h> int main() { int num; ...

C++ Program to Convert Celsius to Fahrenheit Using Inline Function

C++ Inline Function – Celsius to Fahrenheit

C++ Program to Convert Celsius to Fahrenheit Using Inline Function


#include <iostream>
using namespace std;

inline float celsiusToFahrenheit(float c)
{
    return (c * 9 / 5) + 32;
}

int main()
{
    float c;
    cout << "Enter temperature in Celsius: ";
    cin >> c;

    cout << "Fahrenheit = " 
         << celsiusToFahrenheit(c);
    return 0;
}
  

πŸ“˜ Explanation:

This C++ program converts temperature from Celsius to Fahrenheit using an inline function.

The inline function celsiusToFahrenheit() applies the formula:

Fahrenheit = (Celsius × 9 / 5) + 32

Since the function is small and frequently used, declaring it as inline can improve performance by reducing function call overhead.

🧾 Sample Output:

Enter temperature in Celsius:
25
Fahrenheit = 77
  

πŸ”‘ Keywords:

C++ inline function temperature conversion, Celsius to Fahrenheit program, inline function example in C++, C++ basic programs

πŸ” Search Description:

Learn how to convert Celsius to Fahrenheit in C++ using inline function. Includes full program, explanation, and output.

πŸ“Œ Hashtags:

#CPlusPlus #InlineFunction #TemperatureConversion #CPPBasics #CelsiusToFahrenheit #1printf

Comments

Popular Posts

πŸŒ™