Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.60/5 (4 votes)
See more:
by using scanf to print the Date of birth..but there are some condition
1)using 1 scanf fucntion we print the date and month and year..
2when a time date like 10 then attomatically -(symbel) will come here...next i will print month then also come the -(symbel).
at last i want date of birth like 10-06-1996


OUT PUT IN following farmed
print your date of birth::10-06-1996
your date of birth ::10-06-1996
Posted

Scant does not print: it reads a value from the user and converts it to an internal form.

To output the date, use print, not scanf.

I'm not a big fan of scanf at the best of times, it's generally better to read a string, and then use sscanf to parse that, as it's a lot easier to debug, and better for error reporting as well.

But the printf for as date is pretty simple:
printf("%02d-%02d-%04d", day, month, year);
 
Share this answer
 
Comments
Member 10241683 30-Aug-13 2:13am    
i am not satisfied......this is not what i want...
In scanf............when i print date then attomatically - will come after date.........
scanf("%d%d%d",&d,&m,&y);
when i enter 10 then - will come attomatically....then i will type month then - will come...this is i want?????
OriginalGriff 30-Aug-13 2:32am    
That doesn't make a lot of sense: scanf does not print - if reads input.
Perhaps if you try rephrasing that, remembering that I can't see your screen?
[no name] 30-Aug-13 3:27am    
Why don't you post your code. That will make it clearer.
Member 10241683 30-Aug-13 3:35am    
which code?????
Richard MacCutchan 30-Aug-13 3:44am    
The code you have written. Better still read scanf() which explains how it works.
import os,urllib
Path=os.getcwd()
if os.path.exists("Engineering")!=True:
os.makedirs("Engineering")
os.chdir("Engineering")
Error="<html><head><title>Apache Tomcat/7.0.16 - Error report</title>"
## Starting of Semester 1 Mathematics ##

def Engg(Chapter_Name,Chapter,Prasad_Modules):
if os.path.exists("Mathematics-I/"+Chapter_Name)!=True:
os.makedirs("Mathematics-I/"+Chapter_Name)
for Module in range(1,int(Prasad_Modules)+1):
url="http://engg1a.nuz.rgukt.in/content/Semester1/Mathematics-I/M_"+str(Chapter)+"."+str(Module)+"/M_"+str(Chapter)+"."+str(Module)+"_RM/M_"+str(Chapter)+"."+str(Module)+"_RM.pdf"
print url
Page=urllib.urlopen(url).read()
if Page[0:62]!=Error:
File_Name="Mathematics-I/"+Chapter_Name+"/"+str(Module)+". "+Chapter_Name+".pdf"
file=open(File_Name,"w")
file.write(Page)
file.close()
Engg("Sequences & Series",1,9)
Engg("Differential Equations",2,9)
Engg("Functions of Several Variables",3,10)
Engg("Numerical Analysis",4,8)

## Ending of Semester 1 and Starting of Semester 2 Mathematics ##
 
Share this answer
 
file:///home/student/Desktop/diy-birthday-card.jpg
happy birthday
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900