Link to home
Start Free TrialLog in
Avatar of captainx01
captainx01

asked on

Program requesting an integer

Write a program to request an integer n from 1 to 9 and  print a line and print a line of output consisting of ascending digits from 1 to n followed by desecending digits from n - 1 to 1. For example, if n = 5, print the line
   123454321
//program requesting an integer from 1 to 9 and print a line of digits
//in asscending digits from 1 to the integer
#include <stdio.h>
main(){
       int n, count;
       printf ("please enter an number from 1 - 9:");
       scanf ("\n%d",&n);{
       if ((n>=1) &&(n<=9));
       {
       printf ("\n\n%d",&n);
       
       for {(count =1; count <n; count ++);
       
       printf ("%d", count);
       printf ("%d", n);
       
       for (count=count - 1; count >=1; count --);
       }
       printf ("%d",&count);
       system ("pause");
       }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mrjoltcola
mrjoltcola
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial