Skip to main content

Featured

Mastering Hollow Square Patterns in C: Stars, Numbers, Alphabets & Binary

πŸ”’ C Program to Print Hollow Continuous Number Square πŸ“„ Source Code: #include <stdio.h> int main() { int num, k = 0; printf("Enter the number:\n"); scanf("%d", &num); for(int i = 1; i <= num; i++) { for(int j = 1; j <= num; j++) { if(i == 1 || i == num || j == 1 || j == num) { // k increments sequentially only along the borders printf("%d ", k++); } else { printf(" "); } } printf("\n"); } return 0; } πŸ“‹ Copy Code πŸ’» Expected Output (Input: 5): Enter the number: 5 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 πŸ”’ C Program to Print Standard Hollow Binary Row Square πŸ“„ Source Code (Fixed Specifier): #include <stdio.h> int main() { ...

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

πŸŒ™