Database Management Exam  >  Database Management Videos  >  Introduction to Fortran Programming (Basic Level)  >  Fortran Programming Tutorials (Revised) : 016 : Printing Strings and Quote Mixing

Fortran Programming Tutorials (Revised) : 016 : Printing Strings and Quote Mixing Video Lecture | Introduction to Fortran Programming (Basic Level) - Database Management

41 videos

FAQs on Fortran Programming Tutorials (Revised) : 016 : Printing Strings and Quote Mixing Video Lecture - Introduction to Fortran Programming (Basic Level) - Database Management

1. How can I print a string in Fortran programming?
Ans. In Fortran programming, you can print a string using the WRITE statement. You can specify the string to be printed within quotation marks. For example: WRITE(*, *) "Hello, World!" This will print the string "Hello, World!" to the standard output.
2. Can I mix quotes in Fortran programming?
Ans. Yes, you can mix single quotes and double quotes in Fortran programming. Both types of quotes can be used to define strings. For example: WRITE(*, *) 'This is a single-quoted string' WRITE(*, *) "This is a double-quoted string" Both of these statements are valid and will print the respective strings to the standard output.
3. How can I concatenate strings in Fortran programming?
Ans. In Fortran programming, you can concatenate strings using the // operator. For example: CHARACTER(LEN=20) :: str1 = 'Hello' CHARACTER(LEN=20) :: str2 = 'World!' CHARACTER(LEN=40) :: concatenated_str concatenated_str = str1 // ' ' // str2 This will concatenate the strings str1, a space, and str2, and store the result in the variable concatenated_str.
4. How can I print a variable along with a string in Fortran programming?
Ans. To print a variable along with a string in Fortran programming, you can use the concatenation operator (//) or the formatted WRITE statement. For example: INTEGER :: num = 42 WRITE(*, *) 'The value of the variable is ' // num or WRITE(*, '(A, I3)') 'The value of the variable is ', num Both of these statements will print the value of the variable num along with the provided string.
5. How can I handle special characters in Fortran strings?
Ans. To handle special characters in Fortran strings, you can use escape sequences. The most commonly used escape sequences are: - \n for a new line - \t for a tab - \' for a single quote - \" for a double quote For example: WRITE(*, *) 'This is a string with a new line\nand a tab\tand quotes: \'\'\"\"' This will print the string "This is a string with a new line" on one line, followed by "and a tab and quotes: ''"" on the next line.
Explore Courses for Database Management exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

video lectures

,

Objective type Questions

,

Sample Paper

,

Fortran Programming Tutorials (Revised) : 016 : Printing Strings and Quote Mixing Video Lecture | Introduction to Fortran Programming (Basic Level) - Database Management

,

MCQs

,

Exam

,

Fortran Programming Tutorials (Revised) : 016 : Printing Strings and Quote Mixing Video Lecture | Introduction to Fortran Programming (Basic Level) - Database Management

,

ppt

,

study material

,

shortcuts and tricks

,

Semester Notes

,

Fortran Programming Tutorials (Revised) : 016 : Printing Strings and Quote Mixing Video Lecture | Introduction to Fortran Programming (Basic Level) - Database Management

,

Previous Year Questions with Solutions

,

past year papers

,

Summary

,

Extra Questions

,

Important questions

,

Viva Questions

,

mock tests for examination

,

pdf

,

practice quizzes

,

Free

;