Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C Program to read an IP address from user's input and check if the input IP address is valid or not. Fill in the Blank

C Program to read an IP address from user's input and check if the input IP address is valid or not.

Fill in the Blank to complete the program!

#include int main(){ int ip1=0,ip2=0,ip3=0,ip4=0; int n=0; n=scanf("_______A2._________", _______B2.__________); if (n!=4) { printf("Please enter IP address following the IP address pattern"); _______C2._______ } int valid=0; if (ip1<0 || ip1>255) valid = 1; else if (ip2<0 || ip2>255) valid = 2; else if (ip3<0 || ip3>255) valid = 3; else if (_______D2._______) valid = 4; if (_______E2._______) { printf("INVALID: Please enter a number between 0-255 in field %d (index starts from 1 from left) ",valid); }else{ printf("The ip you entered is valid "); } return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions