Pages

Friday, December 13, 2024

C Lab BCA 1st Semester

 C Lab Lectures Problems/Experiments


Lecture-1:- 

Task:- Convert from Fahrenheit to Celcius Program.

#include <stdio.h>
// Fahrenheit to Celcius = C= 5/9 * (F−32)
int main() { // Declare variables for fahrenheit and celcius float c , f; // User inputs value of Fah Temp printf("Enter Fahrenheit Temp Value:- ");
// Reads the value of fahrenheit scanf("%f", &f );
// Formula c = (5.0/9.0) *(f-32);
// Prints the value of Celcius printf("Temp in Celcius is:- %f", c);
return 0; }
}
Problems I faced:- 

1. i had the formula after float variable was declared so that's why it didn't work at few attempts.


2. 
need to put the formula before it's prints/displays the final value of celcius, other code won't work.

No comments:

Post a Comment

3917. Count Indices With Opposite Parity (Brute Force) O(n2) + Optimized Solution O(n) + tips LEETCODE WEEKLY 500

  class Solution {     public int [] countOppositeParity ( int [] nums ) {          // approach 1 - checks every pair         int n = n...