Check if a number is contiguous to each other !
#include <stdio.h>
# include <math.h>
int main (){
int num,s,m,lim,Nnum;
printf("enter the number : \n");
scanf("%d",&num);
printf("Enter the matching Number : \n");
scanf("%d",&s);
m = ceil(log10(num));
//printf("%d",m);
lim = m -3;
Nnum = num / (pow(10,lim));
if(Nnum == s){
printf("N1 is contigeous");
} else {
printf("N1 is not !");
}
}
Comments
Post a Comment