Introduction Data type Variable-Constant Keyword-Identifier Operations Input&Output If-else Switch loops String Array Functions Recursion-Function Mat-Function Pointers File handling Read & write Error handling Read & write error handling


Input & Output

scanf()

The method scanf is used to take input value from user

scanf("%d", variable_name);

Here %d is the format specifier in C, we can use different format like %f, %c etc . Based on what type of data we are declaring.


printf()

Printf function is used for printing the output

printf("Hello Dear");
Here we see various format specifier in C

Character

Input : scanf("%c",&name);

Output : printf("%c", name);

Integer

Input : scanf("%d",&age);

Output : printf("%c", age);

Float

Input : scanf("%f",&percentage);

Output : printf("%f", percentage);



Example
#include <stdio.h>

    int main() {
        char name[30];
        int age;
        char grade;
                           
        printf("Enter the name,age,grade\n");
        scanf("%s %d %c", &name, &age, &grade);
        printf("Hello %s how are you\n",name);
        printf("Plese check and confirm : - %s, %d, %c",name,
        age,grade);
        return 0;
    }             
        

OutPut
Enter the name,age,grade
Vedanth
28
A
Hello Vedanth how are you 
Plese check and confirm : - Vedanth, 28, A
                    
Click to Open Popup Box !





@2022, Padma Education.

We cannot warrant full correctness of all content, we try to give our best. While using Padma education website, you agree to have read and accepted our terms and Conditions , privacy policy.