#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
int ran_s,ran_e;
printf("What do you want to do.......\n\nIf you want to print odd number then type 'o'.....\nElse you want to print even number then type 'e'...\n\nWaiting for your wish: ");
scanf("%c",&ch);
printf("\nEnter the start range: ");
scanf("%d", &ran_s);
printf("\nEnter the end range: ");
scanf("%d", &ran_e);
if(ch=='o' || ch=='O')
{
printf("\nThe odd number between your given range : \n---------------------------------------------------\n\n");
for(;ran_s<=ran_e;ran_s++)
{
if(ran_s%2==1)
{
printf("\n\t\t%d", ran_s);
}
}
}
else if(ch=='e' || ch=='E')
{
printf("\nThe even number between your given range : \n---------------------------------------------------\n\n");
for(;ran_s<=ran_e;ran_s++)
{
if(ran_s%2==0)
{
printf("\n\t\t%d", ran_s);
}
}
}
getch();
}
#include<conio.h>
void main()
{
char ch;
int ran_s,ran_e;
printf("What do you want to do.......\n\nIf you want to print odd number then type 'o'.....\nElse you want to print even number then type 'e'...\n\nWaiting for your wish: ");
scanf("%c",&ch);
printf("\nEnter the start range: ");
scanf("%d", &ran_s);
printf("\nEnter the end range: ");
scanf("%d", &ran_e);
if(ch=='o' || ch=='O')
{
printf("\nThe odd number between your given range : \n---------------------------------------------------\n\n");
for(;ran_s<=ran_e;ran_s++)
{
if(ran_s%2==1)
{
printf("\n\t\t%d", ran_s);
}
}
}
else if(ch=='e' || ch=='E')
{
printf("\nThe even number between your given range : \n---------------------------------------------------\n\n");
for(;ran_s<=ran_e;ran_s++)
{
if(ran_s%2==0)
{
printf("\n\t\t%d", ran_s);
}
}
}
getch();
}
No comments:
Post a Comment