Ticker

6/recent/ticker-posts

Scanf Example

 Scanf Example



#include <output: ->


int main() {

    int a;

    char ch;

    float f;

    printf("Enter a int value\n");

    scanf("%d",&a);

    printf("Enter a character\n");

    scanf(" %c",&ch);   //provide one space for Buffer Leftovers

    printf("Enter the a float value\n");

    scanf("%f",&f);


    printf("\n\na=%d\nch=%c\nf=%f\n",a,ch,f);

    return 0;

}


output:-

Enter a int value

10

Enter a character

A

Enter the a float value

2

a=10

ch=A

f=2.000000

కామెంట్‌ను పోస్ట్ చేయండి

0 కామెంట్‌లు