formatted
Printf function is used in c language. Printf is used to print something to the standard output. ex: printf ('welcome');
printf("%s",variable);
formatted
You can use fputs() instead of printf().
putchar ('%'); puts ("%"); printf ("%%"); etc...
to write and read the values
void main() { int a,b,c; clrscr(); printf("Enter the value of a:"); scanf("%d",&a); printf("\nEnter the value of b:"); scanf("%d",&b); printf("\nEnter the value of c:"); scanf("%d",&c); if(a>b) { if(a>c) { if(b>c) { printf("c is smallest\n"); printf("b is middle\n"); printf("a is largest\n"); } else { printf("b is smallest\n"); printf("c is middle\n"); printf("a is largest\n"); } } else { printf("b is smallest\n"); printf("a is middle\n"); printf("c is largest\n"); } } else if(b>c) { if(a>c) { printf("c is smallest\n"); printf("a is middle\n"); printf("b is largest\n"); } else { printf("a is smallest\n"); printf("c is middle\n"); printf("b is largest\n"); } } else { printf("a is smallest\n"); printf("b is middle\n"); printf("c is largest\n"); } getch(); }
Yes. However, C is a type-sensitive language thus PRINTF and printf would need to be defined as separate functions. However, names using all caps are conventionally used to denote macros in C thus you can easily define PRINTF as an alias for printf: #define PRINTF printf; int main (void) { PRINTF ("%d", 42); } The C precompiler will substitute all instances of the symbol PRINTF with printf, thus the code seen by the compiler will become: int main (void) { printf ("%d", 42); }
I believe, you can use C-function - printf().
for (first=n; first>=10; first/=10);
[ Fibonacci series___: ] #include<stdio.h> int main(void) { int n,i,c,a=0,b=1; printf("Enter Fibonacci series of nth term : "); scanf("%d",&n); printf("%d %d ",a,b); for(i=0;i<=(n-3);i++) { c=a+b; a=b; b=c; printf("%d ",c); } }
The C language uses the ending curly brace to mark the end of an "if" statement, in the same place that other languages use "endif":int main(void){int bunnies = 2;if( bunnies ){printf("Hop, Hop\n");};printf( "Goodbye.\n" );}