Computer Science, asked by dkvskeerthi, 1 year ago

Write a 'C' program to arrange the even digits first and odd digits second of the given number vice versa.

Answers

Answered by imhkp4u
5

#include<stdio.h>

int main(){

int n,r,d;

printf(" Enter an integer number: ");

scanf("%d",&n);

printf("\n The Even digits present in %d are \n",n);

while(n>0){

d = n % 10;

n = n / 10;

r = d % 2;

if(r == 0)

printf("\n %d.",d);

}

return 0;

}


By simply adding an else condition you will get the list of odd digits as well.

Similar questions