The source code is below.
#include <stdio.h> int main() { long long n; int count; lable: count = 0; printf("Enter your contact number : "); scanf("%lld", &n); //know that enterd interger(contact number) have how many numbers in it while (n != 0) { n /= 10; ++count; } //if numbers are 10 then your contact number is right if(count==10) { printf("contact number enterd sucessfully\n"); goto exit; } else //else numbers are not 10 then invalid contact number and enter again { printf("In valid contact number enter again...........\n"); goto lable; } exit: printf("contact number : %lld ",n); return 0; }
In this code, I try to enter the contact number from the user and it is checked how many numbers in your contact number then it is 10 numbers so it is right, but it is not 10 It is showing an error and enter the number from the user again. when the number is right program is print user number 0. Please guide me what is the problem with this code?
https://stackoverflow.com/questions/66073474/when-i-am-trying-to-take-a-contact-number-from-a-user-and-i-am-print-it-shows-al February 06, 2021 at 12:06PM
没有评论:
发表评论