IPv4 Address Validity


C CODE:

#include<stdio.h>
#include <stdlib.h>

int main()
{
int a1,a2,a3,a4;
scanf("%d.%d.%d.%d",&a1,&a2,&a3,&a4);
if(a1<256&&a2<256&&a3<256&&a4<256)
{
    printf("Valid");
}else
printf("Invalid");

}

Comments

Popular posts from this blog

Reverse String Till Underscore

Count of common characters in two strings

RECTANGULAR SUM