বুধবার, ১৫ সেপ্টেম্বর, ২০১০

06. How to use scanf

Many new C programmer having problem to use scanf. Today i want to write something about use of scanf. Scanf is a function We use it for input. If i need to input something to a user then i simply use scanf.  Look at this cord.

Cord:

/* Use of scanf */

#include<stdio.h>
main()
{
int a;
printf("Enter a number: ");
scanf("%d",&a);
printf("%d",a);
getch();
}


In this cord I use printf and scanf. In printf function there is no( & ), but in scanf there mast be a (&) remember it. See when we use scanf  we first declared what the variables type was
"%d" for int ,"%f" for float ,%e for double ,"%c" for char , "%s" for strings.

  Hear i use scanf for input something. Then i use printf to print that thing which i get input.

Writern by arnob

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন