Check whether a number is even or odd

#include<stdio.h&t;

int main()
{
int num;
printf(“Enter any number :: “);
scanf(“%d”,&num);

if(num%2 == 0)
printf(“%d is Even Number”,num);
else
printf(“%d is odd Number”,num);

return 0;
}

Output::
Enter any number ::
11
11 is odd Number

or

Enter any number ::
10
10 is Even Number

Advertisements

Sizeof Function

#include<stdio.h>
/*
Sizeof function @kodingkeys@keycomputer
*/
int main()
{
int i;
float f;
double d;
char c;

// Sizeof operator is used to evaluate the size of a variable
printf(“Size of int: %ld bytes\n”,sizeof(i));
printf(“Size of float: %ld bytes\n”,sizeof(f));
printf(“Size of double: %ld bytes\n”,sizeof(d));
printf(“Size of char: %ld byte\n”,sizeof(c));

return 0;
}

Output:
Size of int: 4 bytes
Size of float: 4 bytes
Size of double: 8 bytes
Size of char: 1 byte