/*Now i want to share you a concept how to find odd and even number which you have input as a starting and ending value in C Programming ..
01.Firstly i have to need three integer variable declaration (int minimum,maximum,input_number;).
02.After variable declaration ,i need the code by which can i input a starting and a ending value (printf("Enter Your Starting Number: ");
scanf("%d",&minimum);
printf("Enter Your Ending Number: ");
scanf("%d",&maximum);)
03.Then it is necessary to me the logic implementation "(for(input_number=minimum;input_number<=maximum;input_number++)")
04.After logic implementation it have to need another condition by which the program compare this to input range which one is even(" if(input_number%2==0)") and which is odd("if(input_number%2!=0)").
05.Finally show the output result ..
Here the code and Screenshot
*/
//Developed By Muhammad Rakib Hasan.
//Even and Odd separation By C Programming
#include<stdio.h>
int main(){
int minimum,maximum,input_number;
printf("Enter Your Starting Number: ");
scanf("%d",&minimum);
printf("Enter Your Ending Number: ");
scanf("%d",&maximum);
printf("Even Number of Given Range %d to %d is :",minimum,maximum);
for(input_number=minimum;input_number<=maximum;input_number++)
if(input_number%2==0)
printf("\t%d",input_number);
printf("\n\nOdd Number of Given Range %d to %d is :",minimum,maximum);
for(input_number=minimum;input_number<=maximum;input_number++)
if(input_number%2!=0)
printf("\t%d",input_number);
return 0;
}
01.Firstly i have to need three integer variable declaration (int minimum,maximum,input_number;).
02.After variable declaration ,i need the code by which can i input a starting and a ending value (printf("Enter Your Starting Number: ");
scanf("%d",&minimum);
printf("Enter Your Ending Number: ");
scanf("%d",&maximum);)
03.Then it is necessary to me the logic implementation "(for(input_number=minimum;input_number<=maximum;input_number++)")
04.After logic implementation it have to need another condition by which the program compare this to input range which one is even(" if(input_number%2==0)") and which is odd("if(input_number%2!=0)").
05.Finally show the output result ..
Here the code and Screenshot
*/
//Developed By Muhammad Rakib Hasan.
//Even and Odd separation By C Programming
#include<stdio.h>
int main(){
int minimum,maximum,input_number;
printf("Enter Your Starting Number: ");
scanf("%d",&minimum);
printf("Enter Your Ending Number: ");
scanf("%d",&maximum);
printf("Even Number of Given Range %d to %d is :",minimum,maximum);
for(input_number=minimum;input_number<=maximum;input_number++)
if(input_number%2==0)
printf("\t%d",input_number);
printf("\n\nOdd Number of Given Range %d to %d is :",minimum,maximum);
for(input_number=minimum;input_number<=maximum;input_number++)
if(input_number%2!=0)
printf("\t%d",input_number);
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন