Example 1: Program to find grade in C
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int m;
printf("Enter your marks:");
scanf("%d",&m);
if(m>=33 && m<50)
printf("Grade C");
else if(m>=50 && m<75)
printf("Grade B");
else if(m>=75 && m<=100)
printf("Grade A");
getch();
}
Example 2: Program to enter element is number, small alphabet, capital alphabet or special symbol
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char c;
printf("Enter any element:");
scanf("%c",&c);
if(c>=65 && c<=90)
printf("Capital alphabet");
else if(c>=97 && c<=122)
printf("Small alphabet");
else if(c>=48 && c<=57)
printf("Number");
else
printf("Special character");
getch();
}
No comments:
Post a Comment