My program is correct or not confused because in computer programs display differently than in it should i have to use scanf ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

My program is correct or not confused because in computer programs display differently than in it should i have to use scanf ?

Name of student: Father 's name: Mother 's name: Name of course: Semester: Name of college: https://code.sololearn.com/c5c5QFp9Tgeo/?ref=app

8th Nov 2018, 1:03 PM
Lata Mishra
Lata Mishra - avatar
9 Answers
+ 10
So do you want to ask user from input or just want to print each field on clicking enter ??? If you want user input then use scanf as it will ask for one field then you have to click enter. Then it will ask next field, click enter and so on. If you want to just display the details on clicking enter, then use getch () function after every printf staement. Use the header file conio.h with it. Note : this will work in your pc but not in the Sololearn compiler.
8th Nov 2018, 1:40 PM
Nova
Nova - avatar
+ 10
And you have also not written any value in the printf. If you want to display the values then write some values in the printf statement
8th Nov 2018, 1:43 PM
Nova
Nova - avatar
+ 7
Lata Mishra I think in pc and here both places the output of your code will be same because its only print statements which you have used in the program
8th Nov 2018, 1:13 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 7
What you want to do in above program
8th Nov 2018, 1:17 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
There is any error in this program or logic mistake please help to solve
8th Nov 2018, 1:14 PM
Lata Mishra
Lata Mishra - avatar
+ 1
Ok thanks
8th Nov 2018, 1:42 PM
Lata Mishra
Lata Mishra - avatar
0
My question is i have to write a program to display the following : NAME OF STUDENT: FATHERS NAME: MOTHERS NAME: AGE OF STUDENT: NAME OF COURSE: SEMESTER: NAME OF COLLEGE: Which i actually did but confused that it will ask me to answer the following data or not for example:- NAME OF STUDENT:rohan than when i press enter than it will ask next question for example:- FATHERS NAME:sohan and so on.. so program is correct to implement this data.
8th Nov 2018, 1:25 PM
Lata Mishra
Lata Mishra - avatar
0
You need to define variables to store your input at the top of the program. Easiest way would be lines like char name_of_student[100]; After each prompt add a line to accept input using the fgets() function: fgets(name_of_student, 100, stdin); At the end of your program print all your variables: printf("NAME OF STUDENT: %s\n", name_of_student);
8th Nov 2018, 4:20 PM
David Rolston
David Rolston - avatar
0
Please solve it whatever i did because i am frustrated doing this code or explain line by line about my mistake
9th Nov 2018, 12:58 AM
Lata Mishra
Lata Mishra - avatar