Looping in C Programming Language

 Looping in C Programming Language Use: When we want to perform specific task repeatedly then we can use looping. In C Language there are three type of loop: For Loop While Loop Do while Loop Nested for Loop Each Loop statement requires three things: Initialization  Test Condition Increment/Decrement Operation 1. For Loop: For Loop is a repetition control structure which allow us to write a loop that is executed a specific number of time. Syntax:               for( initialization ; test condition; increment/decrement operation)                 {                    ------                    body of for loop;                    ------               } 2. While Loop: While Loop is use to per to p...

Input-Output Function in C Programming Language

 Input-Output Function in C Programming Language

  • System defined/Built-in Function:
    • A Function which is already defined by system not by user is called system defined functions.
    • C Introduce different system defined functions like - Input-Output functions, Mathematical functions, String functions, Console related functions etc...
    • Source code/Definition code of system defined function are in header file.
    1.  INPUT-OUTPUT FUNCTIONS:
      • A function which is use to take input from user and display output or massage on console screen is known as input-output functions.
      • Input Function:
        • scanf(): scanf() is input function which is use to take input from user.
        • getchar(): getchar() is a input function which is use to take single character from user.
        • gets(): gets() is a in-built function which is use to take string from user.
        • getc(): getc() is a input function which is use to take single character from user.
      • Output Function:
        • printf(): It is use to display message or value on console screen.
        • putc(): It is an output function which is use to display single character on console screen.
        • puts(): It is an output function which is use to display string on console screen.
      • All this input-output function are in <stdio.h> header file.
      • stdio.h - Standard Input Output Header File.
    2. CONSOLE FUNCTIONS:
      • clrscr(): It is a system defined function which is use to clear console screen.
      • Source code of clrscr function is in <conio.h> header file.
      • conio.h - Console Input Output Header File.
    3. MATHEMATICAL FUNCTIONS:
      • Mathematical functions are use to perform math operations.
      • To use these function, we have to include math.h system library/header file.
        • pow(): pow() function is use to find out power of any number.
          • Syntax: pow(base, exponent);
          • Example: x= pow(5,2) x=5*5 x=25
        • sqrt(): sqrt() function is use to find out square root of any number.
          • Syntax: sqrt(number);
          • Example: x= sqrt(25); x=5
        • floor(): floor() function is use to find out largest integer that is smaller than or equal to any number.
          • Syntax: floor(x);
          • Example: floor(2.9) = 2
        • ceil(): ceil() function is use to find out smallest integer that is greater than or equal to any number.
          • Syntax: ceil(x);
          • Example: ceil(2.9) = 3

        
 

Comments

Popular posts from this blog

Data Types in C Program

Different Modules to solve the program/problem

Operators in C Program