Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
35
Task/Gapful-numbers/C/gapful-numbers.c
Normal file
35
Task/Gapful-numbers/C/gapful-numbers.c
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#include<stdio.h>
|
||||
|
||||
void generateGaps(unsigned long long int start,int count){
|
||||
|
||||
int counter = 0;
|
||||
unsigned long long int i = start;
|
||||
char str[100];
|
||||
|
||||
printf("\nFirst %d Gapful numbers >= %llu :\n",count,start);
|
||||
|
||||
while(counter<count){
|
||||
sprintf(str,"%llu",i);
|
||||
if((i%(10*(str[0]-'0') + i%10))==0L){
|
||||
printf("\n%3d : %llu",counter+1,i);
|
||||
counter++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned long long int i = 100;
|
||||
int count = 0;
|
||||
char str[21];
|
||||
|
||||
generateGaps(100,30);
|
||||
printf("\n");
|
||||
generateGaps(1000000,15);
|
||||
printf("\n");
|
||||
generateGaps(1000000000,15);
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue