Video Link: https://youtu.be/sARaqR0hRI4 Tutorial Link: https://www.programiz.com/c-programming/c-data-types
#include <stdio.h>
int main() {
int age = 10;
printf("%d", age);
return 0;
}
Output
10
#include <stdio.h>
int main() {
int age = 10;
printf("Age = %d", number);
return 0;
}
Output
Age = 10
#include <stdio.h>
int main() {
double number = 12.45;
printf("%lf", number);
return 0;
}
Output
12.450000
#include <stdio.h>
int main() {
double number = 12.45;
printf("%.2lf", number);
return 0;
}
Output
12.45
#include <stdio.h>
int main() {
double number = 12.45;
float number1 = 10.9f;
printf("%.2lf", number);
printf("\n%f", number1);
return 0;
}
Output
12.45
10.900000
#include <stdio.h>
int main() {
double number = 12.45;
float number1 = 10.9f;
printf("%.2lf", number);
printf("\n%.1f", number1);
return 0;
}
Output
12.45
10.9
#include <stdio.h>
int main() {
double number = 5.5e6;
printf("%lf", number);
return 0;
}
Output
5500000.000000
#include <stdio.h>
int main() {
char character = 'z';
printf("%c", character);
return 0;
}
Output
z
#include <stdio.h>
int main() {
char character = 'z';
printf("%c", character);
printf(" %d", character);
return 0;
}
Output
z 122
#include <stdio.h>
int main() {
int age;
double number;
printf("int size = %zu", sizeof (age));
printf("\ndouble size = %zu", sizeof(number));
return 0;
}
Output
int size = 4
double size = 8
Q. What is the output of the following code?
#include <stdio.h>
int main() {
int a = 5;
float a = 9.3;
printf("%d", a);
}
Options
- a. 5
- b. 9.3
- c. 14.3
- d. Error
Answer d