Video Link: https://youtu.be/xi2wf0Zy2Y4 Tutorial Link: https://www.programiz.com/c-programming
#include <stdio.h>
int main() {
int a = 5;
int b = 9;
int result = a + b;
printf("%d", result);
return 0;
}
Output
14
#include <stdio.h>
int main() {
char a = '5';
int b = 9;
int result = a + b;
printf("%d", result);
return 0;
}
Output
62
#include <stdio.h>
int main() {
double a = 5.67;
int b = 9;
int result = a + b;
printf("%d", result);
return 0;
}
Output
14
#include <stdio.h>
int main() {
double a = 5.67;
int b = 9;
double result = a + b;
printf("%lf", result);
return 0;
}
Output
14.670000
- long double
- double
- float
- long
- int
- short
- char
#include <stdio.h>
int main() {
int a = 5.67;
printf("%d", a);
return 0;
}
Output
5
#include <stdio.h>
int main() {
double a = 5.67;
int b = 9;
double result = (int)a + b;
printf("%lf", result);
return 0;
}
Output
14.000000
#include <stdio.h>
int main() {
double a = 5.67;
int b = 9;
int result = (int)a + b;
printf("%d", result);
return 0;
}
Output
14
#include <stdio.h>
int main() {
int a = 9;
int b = 2;
double result = a / b;
printf("%lf", result);
return 0;
}
Output
4.000000
#include <stdio.h>
int main() {
int a = 9;
int b = 2;
double result = (double)a / b;
printf("%lf", result);
return 0;
}
Output
4.500000
Q. What is the value of result in the following statement?
int result = '8' + 12;
Options
- 20
- 68
- Error
- 12650
Answer: 2