Skip to content

Instantly share code, notes, and snippets.

@Dbhardwaj99
Created May 25, 2022 14:11
Show Gist options
  • Save Dbhardwaj99/55ba8c87380f40817e73a6d44042e750 to your computer and use it in GitHub Desktop.
Save Dbhardwaj99/55ba8c87380f40817e73a6d44042e750 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main()
{
int i,num,rem,count;
int ar[50];
printf("Enter the number:\n");
scanf("%d",&num);
count = 0;
i = 0;
while(num!=0){
rem = num%10;
num = num-rem;
num = num/10;
if(rem>5){
ar[i] = rem;
++count;
++i;
}
}
printf("There are %d-digits which are more than 5. The digits are: ",count);
for(i=0;i<count;--count)
{
printf("%d ",ar[count-1]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment