C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 11th, 2017, 02:59 PM
Dany Solis Dany Solis is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2017
Posts: 1 Dany Solis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 39 sec
Reputation Power: 0
Syntax errors - Error in Syntaxis count digits number

Hello everyone my name is Dany and I am new to the forum and I need you help.

I have a problem with the syntax of my code, I need to enter a number [>= 777 and <= 700077], if the number is not within this range, then display a message "Does not It is not within range", if it is within the range then display the message "If it is within range" and count the digits of the number entered.

The code works for me, but it shows me the message based on the number of digits that the number has ie if I enter 1001, the number has 4 digits and should only show "If it is within range" and the number has 4 Digits, But it shows me "If it is within range", "If it is within range", "Does not It is not within range", "Does not It is not within range" + the digits of number.

I hope to see myself explained and you can help me.

This is code:

Code:
{
    int i=1,n1,Min=737,Max=700077;
    system("color 0B");
    
    printf("Please, enter a number:: ");
    scanf("%d",&n1);
                               
 do{
       if((n1>Min)&&(n1<Max))

        {
        printf("Number if it is within range:\n", n1);
         }
        else
        {
        printf("Number Does not It is not within range:\n", n1);
         }                  
    
        n1=n1/10;
        i++;
    }
                    
    while(n1/10>0);
    
    printf("You number have %u digits",i);
    
    getch();
    return 0;
}



Image:

Any comments, please let me know.

Regards

DS

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Syntax errors - Error in Syntaxis count digits number


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap