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

Swap two numbers – XOR Operator

#include<stdio.h> /* Swap two numbers @kodingkeys@keycomputer */ int main() { int num1, num2, temp; printf(“Enter two numbers to swap ::”) ; scanf(“%d%d”,&num1, &num2); temp = num1; num1 = num2; num2 = temp; printf(“Swapped numbers %d – %d”,num1, num2) ; return 0; } Output:: Enter two numbers to swap :: 11 12 Swapped numbers 12 – […]

Swap two numbers – without using third Variable

#include<stdio.h> /* Swap two numbers @kodingkeys@keycomputer */ int main() { int num1, num2, temp; printf(“Enter two numbers to swap ::”) ; scanf(“%d%d”,&num1, &num2); temp = num1; num1 = num2; num2 = temp; printf(“Swapped numbers %d – %d”,num1, num2) ; return 0; } Output:: Enter two numbers to swap :: 11 12 Swapped numbers 12 – […]

Swap two numbers – using third Variable

#include<stdio.h> /* Swap two numbers @kodingkeys@keycomputer */ int main() { int num1, num2, temp; printf(“Enter two numbers to swap ::”) ; scanf(“%d%d”,&num1, &num2); temp = num1; num1 = num2; num2 = temp; printf(“Swapped numbers %d – %d”,num1, num2) ; return 0; } Output:: Enter two numbers to swap :: 11 12 Swapped numbers 12 –…

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…

Computer Quotient and Remainder

#include <stdio.h> /* Compute Quotient and Remainder @kodingkeys@keycomputer */ int main() { int num1, num2, q, r; printf(“Enter Divident and Divisor :: “); scanf(“%d%d”,&num1,&num2); // Compute quotient q = num1/ num2; // Compute remainder r = num1 % num2; printf(“Quotient = %d\n”, q); printf(“Remainder = %d”, r); return 0; }  

ASCII Value of a Character

#include<stdio.h> /* ASCII Value of a Character @kodingkeys@keycomputer */ int main() { char c; printf(“Enter a character: “); scanf(“%c”,&c); printf(“ASCII value of %c = %d”, c, c); return 0; }

Multiply two Floating Point Numbers

#include <stdio.h> /* Multiplying two floating point numbers @kodingkeys@keycomputer */ int main() { double num1, num2, result; printf(“Enter two numbers: “); scanf(“%lf %lf”, &num1, &num2; result = num1 * num2; printf(“Product = %.2lf”, result); return 0; }

Add Two Integers

#include<stdio.h> /* Add Two Integer @kodingkeys@keycomputer */ int main() { int num1, num2,sum; printf(“Enter Two Integer :: “); scanf(“%d%d”,&num1,&num2); sum = num1 + num2; printf(“\n\nSum of two numbers -> %d”,sum); return 0; }

Print Integer Entered By user

#include /* Print Integer @kodingkeys@keycomputer */ int main() { int num; printf(“Enter an Integer :: “); scanf(“%d”,&num); printf(“User Entered -> %d”,num); return 0; }

Hello World Program

#include<stdio.h> main() { /* My first program */ printf(“Hello World! \n”); }