in stdio.h:
extern int printf (const char *fmt, ...);
prototype
A category prototype is a member of a category which describes the category best. For example, robins are prototypical birds (i.e. robins are prototypes of the category 'birds'). Of course, this greatly depends on perception and cultural knowledge.
The purpose of a plastic prototype is to test invention, attract investors, and or get the companies to license the invention idea. And the overall purpose is to make you money from invention idea.
prototype
#include<stdio.h> #include<string.h> #include<conio.h> void main() { int cust_no, unit_con; float charge,surcharge=0, amt,total_amt; char nm[25]; clrscr(); printf("enter the customer IDNO :\t"); scanf("%d",&cust_no); printf("\nenter the customer Name :\t"); scanf("%s",nm); printf("\nenter the unit consumed by customer :\t"); scanf("%d",&unit_con); if (unit_con <200 ) charge = 1.20; else if (unit_con>=200 && unit_con<400) charge = 1.60; else if (unit_con>=400 && unit_con<600) charge = 2.00; else charge = 2.50; amt = unit_con*charge; if (amt>300) surcharge = amt*15/100.0; total_amt = amt+surcharge; if (total_amt < 25) total_amt =25; clrscr(); printf("\t\t\tElectricity Bill\n\n"); printf("Customer IDNO :\t%5d",cust_no); printf("\nCustomer Name :\t%s",nm); printf("\nunit Consumed :\t%5d",unit_con); printf("\nAmount Charges @Rs. %4.2f per unit :\t%8.2f",charge,amt); printf("\nSurchage Amount :\t%8.2f",surcharge); printf("\nNet Amount Paid By the Customer :\t%8.2f",total_amt); getch();}
== == What is printf in c or prototype of printf with example (q) What is prototype of printf function ? Explain each term. Ans: Prototype of printf function is : int printf( const char *format ,…) Explanation of each term : Parameter of printf function is : (three continuous dots) : It is called ellipsis. It indicates the variable number of arguments. Example of ellipsis: #include void ellipsis(int a,...); void main() { int a=5,b=10; clrscr(); ellipsis(a,b); getch(); } void ellipsis(int a,...) { printf("%d ",a); } Output:5 So printf function can have any number of variables as an argument.
Printf function is used in c language. Printf is used to print something to the standard output. ex: printf ('welcome');
#include <stdio.h> int findcube(int); // prototype int main() { int a,b; printf("Enter a number: "); scanf("%d",&a); b=findcube(a); printf("The cube of %d is %d\n",a,b); } int findcube(int x) { return x*x*x; }
it's not a statement, it's a function: len= printf (format, ...more-parameters...);
printf is a function that prints formatted text to the standard output stream (stdout). To make use of it in C++, you must include cstdio or any file that includes cstdio. For more information, see related links.
when we write definition of a function i.e; body of a function above main() function, then the function prototype be omitted. -Ramashankar Nayak,M.C.A,Pondicherry University
The printf() function prints a formatted string.
Syntax errors and prototype errors.
You've forgotten this line: #include <stdio.h>
No, it is a function. But printf does return a value: the number of characters it has written.
It is a function.
int main() { // Call the printf function printf("This is a function call!\n"); return 0; }