Program To Print The No Is Odd or Even
Program To Print The No Is Odd or Even
#include<stdio.h> main() { int n; printf("\n Enter any number: "); scanf("%d",&n); if(n%2==0) { printf("the number is even"); } else { printf("the number is odd"); } getch(); }
printf("\n Press 1 for Addition"); printf("\n Press 2 for Subtractiont"); printf("\n Press 3 for Multiplication"); printf("\n Press 4 for Division"); printf("\n Press 5 for Modulus"); printf("\n Enter your choice: "); scanf("%d",&c); if(c==1) { d = a + b; printf(" Addition : %d",d); } if(c==2) {
e = a-b; printf("\n Subtraction: %d",e); } if(c==3) { f = a*b; printf("\n Multiplication: %d",f); } if(c==4) { g = a/b; printf("\n Division: %d",g); } if(c==5) { h = a%b; printf("\n Modulus: %d",h); } getch(); }
if(i>=97 && i<=122) { printf("\n The character is an lowercase letter"); } if(i>=48 && i<=57) { printf("\n The character is an digit"); } getch(); }
program to read a character from user & print its ASCII value
#include<stdio.h> main() { int i; char a; printf("Enter any character: "); scanf("%c",&a); i=a; printf("Ascii value= %d",i); getch(); }
program to read small character from keyboard & convert it into capital
#include<stdio.h> main() { char a; printf("Enter any character: "); scanf("%c",&a); if(97<a<122) {
a=a-32; printf("\n Lowercase letters=%c",a); } if(65<a<90) { a=a+32; printf("\n Uppercase letters=%c",a); } getch(); }