That is short for "print formatted"; it lets you include format codes to control the output.
You will have to use "printf" when you want to print two slashes one after another in c.
you can put the printf function inside a if() so that you need not use semicolons. for eg to print my name, if(printf("My Name is Maheedharan")) {} this will work. try this out...
#include<stdio.h> Void main() { int a,b; printf("Enter a Number: "); // for print function as an out-put scanf("%d",&a); //for scan function as in input /* Here we can use print function once again as: */ a=a++; printf("%d",a); }
Duhh.. printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); Just kidding. Just loop the printing. int x = 0; for(x = 0; x<11; x++) { printf("hello "); } and if you want each "hello" to be in a new line, use this: printf("hello\n");
Using base in a derived class invokes the base class's corresponding method. For example, something like: class Shape{ public void print(){printf("Generic shape"); ... } class Triangle:Shape{ public void print(){printf("Triangle"); ... } int main() { Triangle x; x.print(); // Should print "Triangle" x.base.print(); // Should print "Generic shape" return 0; }
print f() 1.function 2.built in 3.user only use 4.out put purpose
use cout << simple
You will have to use "printf" when you want to print two slashes one after another in c.
you can put the printf function inside a if() so that you need not use semicolons. for eg to print my name, if(printf("My Name is Maheedharan")) {} this will work. try this out...
#include<stdio.h> Void main() { int a,b; printf("Enter a Number: "); // for print function as an out-put scanf("%d",&a); //for scan function as in input /* Here we can use print function once again as: */ a=a++; printf("%d",a); }
The only way i see is to use : using the right file descriptor
Duhh.. printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); Just kidding. Just loop the printing. int x = 0; for(x = 0; x<11; x++) { printf("hello "); } and if you want each "hello" to be in a new line, use this: printf("hello\n");
printf ("nested printf returned %d\n", printf ("inner printf\n"));
Using base in a derived class invokes the base class's corresponding method. For example, something like: class Shape{ public void print(){printf("Generic shape"); ... } class Triangle:Shape{ public void print(){printf("Triangle"); ... } int main() { Triangle x; x.print(); // Should print "Triangle" x.base.print(); // Should print "Generic shape" return 0; }
Syntax:====================================================================================Suppose you want to print a Character for 50 (or so) Times before entering Main ().Here the code goes:#include "stdio.h"#include "conio.h"void PrintChars (){char cChar;int iTimes, iLoop;printf ("\n Enter a Character to print: ");scanf ("%c", &cChar);printf ("\n How many times you want \'%c\' to print", cChar);scanf ("%d", iTimes);for ( iLoop=1; iLoop
Java doesn't have a printf method. To provide the implementation of printf method of C in java, the java has two print methods. They are1. print()2. println()The first method prints the text in braces on the same line, while the second is used to print on the next line. In fact, ln in println() stands for next line. We need not use /n while working in java.Actually, the System.out.format() function is practically identical to printf in C. When translating code from C to Java, you can generally replace all calls to printf(args...) with calls to System.out.format(args...)....and to answer the original question, Java's System.out.format() method is based off of C's printf() function.
program#include#include#includevoid main(){int a,b,ans,ch;clrscr();printf("enter the value of a and b");scanf("%d%d",&a,&b);printf("1.Addition");printf("\n2.Subtraction");printf("\n3.Multiplication");printf("\n4. exit");printf("enter your choice");scanf("%d",&ch);switch(ch){case 1:ans=a+b;printf("\nAfter Addition:%d",ans);break;case 2:ans=a-b;printf("\nAfter Subtraction:%d",ans);break;case 3:ans=a*b;printf("\nAfter Multiplication:%d",ans);break;case 4:exit(0);break;}getch();}