Posts

C Program to print swap number using third variables

    C Program to print swap number using third variables   #include<stdio.h> #include <conio.h>   void main() {   int a, b, temp;   printf("Enter first number: ");   scanf("%d", &a);   printf("Enter second number: ");   scanf("%d", &b);     temp = a;     a = b;    b = temp;   printf("\nAfter swapping first number = %d\n", a);     printf("After swapping second number = %d", b);   getch(); }   Output: Enter first number: 8 Enter second number: 10 After swapping first number = 10 After swapping second number = 8   C

C Program to print size of variables

  C Program to print size of variables #include<stdio.h> #include <conio.h>   void main() {     int integer;     float float;     double double;     char character;     printf("Size of integer: %zu bytes\n", sizeof(integer));    printf("Size of float: %zu bytes\n", sizeof(float));    printf("Size of double: %zu bytes\n", sizeof(double));    printf("Size of character: %zu byte\n", sizeof(character));       getch(); } Output: Size of integer: 4 bytes Size of float: 4 bytes Size of double: 8 bytes Size of character: 1 byte