Smart Lab Helping Forum

Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: how to print in table form


Newbie

Status: Offline
Posts: 3
Date:
how to print in table form
Permalink  
 


assalam o alaikum ,

i have question regarding assignment. here is the code

----------------------------------------------------------------------------------------------------------

 printf("%s%20s%29s","SUBJECTS","MARKS","Credit Hours");

for (i=0 ; i< 9; i++)

{

printf("\n%d\t\t\t", i);

 scanf("%d", &m);

  

 printf("\t\t\t\t\t\t\t");

 scanf("%d", &ch);

}

-----------------------------------------------------------------------------------------------------------

output:

******

 

students                           marks                              credit hours

0                                            90

                                                                                        3

1                                            89

                                                                                         4                                           

2                                             67                     

                                                                                         2

-----------------------------------------------------------------------------------------------------------

so  the problem is with credit hours...when ever i scanf for credithours it goes into the next line.....and thus the table form gets disturbes...help me out in changing the syntex in such a way that all the user inputs get in a table form..



__________________
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.



Create your own FREE Forum
Report Abuse
Powered by ActiveBoard