Pda Weekly Coding Session
Pda Weekly Coding Session
Code:
Output:
2. Write a C program to get the marks (6 Subjects) from a student,
calculate Total, Average Cut-off mark of that student and display it to
the student.
Code:
Output:
3. Write a C++ program to assign value 5 to following variables a, b, c,
d using a single statement.
Code:
Output:
Output:
Output:
8. Program to convert temperature from Celsius to Fahrenheit and
vice versa using the following formula:F = (C*9/5) +32. Sample
input/output:
Code:
Fahrenheit to Celsius:
Output:
Celsius to Fahrenheit:
Code:
Output:
Output:
10. Write a C program and find the output of the following.
Expression Output
10 == 10 ?
11 > 12 ?
12>=13 ?
13 <10 ?
Code:
Output:
11. Write a c program that calculates the area of a rectangle using
the length and width provided by the user. Use arithmetic operators.
Code:
Output:
12. Write a C program that takes an integer as input and checks if it's
even or odd. Use conditional statements (if-else).
Code:
Output:
14. Write a C++ program that takes three integers as input and finds
the largest among them. Use conditional statements (if-else if).
Code:
Output:
15. Write a C++ program that calculates the Grade Point Average
(GPA) for a student based on their grades.
The program should take the grades as input, calculate the GPA, and
display the result.
Code:
Output:
THEOREY QUESTIONS:
1. List out the fundamental datatypes of c.
In C programming, the fundamental data types form the basic
building blocks for storing and manipulating data. These
include:
1. Pre-increment (`++x`):
- Increments the value of the variable `x` before its current
value is used in the expression.
- The updated value of `x` is used in the expression where the
increment operation is applied.
```c
#include <stdio.h>
int main() {
int x = 5;
int result = ++x;
printf("x: %d\n", x);
printf("result: %d\n", result);
return 0;
}
```
2. **Post-increment (`x++`):**
- Increments the value of the variable `x` after its current
value is used in the expression.
- The current value of `x` is used in the expression, and then
`x` is incremented.
```c
#include <stdio.h>
int main() {
int x = 5;
int result = x++;
printf("x: %d\n", x);
printf("result: %d\n", result);
return 0;
}