C Programming with IDEs: Input, Output, and printf() Function, Assignments of Computer Science

An overview of Integrated Development Environments (IDEs) for C and C++ programming, focusing on their role in software development and the features they offer. The text also covers the basics of input and output in C, including the use of printf() function for displaying output and functions like scanf(), getchar(), and puts() for handling input. Examples of using printf() to print integers, characters, floats, and doubles are provided.

Typology: Assignments

2021/2022

Uploaded on 11/13/2022

deepak-raj-shrestha
deepak-raj-shrestha 🇳🇵

5 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Data Input &
Output
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download C Programming with IDEs: Input, Output, and printf() Function and more Assignments Computer Science in PDF only on Docsity!

Data Input &

Output

IDE(Integrated Development Environment):

 (^) IDEs are usually created to make things easier for the developers and increase their productivity by providing several useful features like code editor, debugging support, compiler, auto code completion, and many others.  (^) IDE provides you with a comprehensive set of tools for software development with C or C++ language.  (^) There are numerous C and C++ IDEs available for experienced developers as well as for newbie programmers to do programming without any hassle, and you can opt for any one of them as per your requirements.

Input & Output

 (^) Input means to provide the program with some data to be used in the program  (^) Output means to display data on the screen or write the data to a printer or a file.  (^) Following are the functions used for standard input and output: o (^) printf() - Show Output o (^) scanf() function - Take Input o (^) getchar() and putchar() function o (^) gets() and puts() function

 (^) The printf() function is the most used function in the C language. This function is defined in the stdio.h header file and is used to show output on the console.  (^) Example: #include <stdio.h> int main() { printf("Welcome to Study"); // using printf() return 0; }

printf() function - Show Output

Print Float and Double

#include <stdio.h> int main() { float num1 = 15.50; //4bytes double num2 = 15556522.0978678; //8bytes printf("Value of num1 is: %f \n", num1); printf("Value of num2 is: %lf", num2); return 0; }

Print multiple outputs

#include <stdio.h> int main() { int day = 20; int month = 11; int year = 2021; printf("The date is: %d-%d-%d", day, month, year); return 0; }

Take Multiple Inputs

#include <stdio.h> int main() { //using scanf() for multiple inputs char gender; int age; printf("Enter your age and then gender(M, F or O): "); scanf("%d %c", &age, &gender); printf("You entered: %d and %c", age, gender); return 0; }