With functions like ecvt, fcvt, gcvt.
write, putchar, putc, fputc etc
If you forget the semicolon, your program won't compile.
printf ("initials");
include <stdio.h> #include <math.h> /* Prototypes */ void realRoots(double, double, double); void imaginaryRoots(double, double, double); int main() { /* Local variables */ int option; double a, b, c, d; printf(" Quadratic Equation ax^2+bx+c=0 \n"); printf("******************* *******************\n"); /* Print list */ printf("\n1) Real roots\n"); printf("2) Imaginary roots\n"); printf("3) Repeated roots\n"); printf("4) Exit\n"); scanf("%d", &option); printf("************* *************************\n"); /* Get a, b, and c from user */ printf("\na = "); scanf("%lf", &a); printf("b = "); scanf("%lf", &b); printf("c = "); scanf("%lf", &c); /* Calculate determinant */ d = (b * b) - (4 * a * c); /* Use switch statement */ switch(option) { /* If 1 was selected */ case 1: realRoots(a, b, sqrt(d)); break; /* If 2 was selected */ case 2: imaginaryRoots(a, b, sqrt(-d)); break; /* If 3 was selected */ case 3: break; /* If 4 was selected */ case 4: break; } /* End program */ return 0; } /* Evaluate real roots */ void realRoots(double a, double b, double d) { /* Calculate */ double firstRoot = (-b/(2 * a)) + (d/(2 * a)); double secondRoot = (-b/(2 * a)) - (d/(2 * a)); /* Print */ printf("\nFirst Real Root: \t%lf\n", firstRoot); printf("\nSecond Real Root: \t%lf\n", secondRoot); } /* Evaluate imaginary roots */ void imaginaryRoots(double a, double b, double d) { /* Calculate */ double x = 2 * a; double first_term = (-b)/x; double second_term = (d)/x; /* Print */ if(second_term >= 0) { printf("\nFirst Imaginary Root: \t%lf + %lfi\n", first_term, second_term); printf("\nSecond Imaginary Root: \t%lf - %lfi\n", first_term, second_term); }else { second_term = -(second_term); printf("\nFirst Imaginary Root: \t%lf + %lfi\n", first_term, second_term); printf("\nSecond Imaginary Root: \t%lf - %lfi\n", first_term, second_term); } }
... int i; for( i = 0; i < 7; ++i ) { printf("*"); } printf("\n"); ...
int main (void) { if(printf("Print whatever you want")) { } }
size of operater - is used to print the size in byte of your data types such as(int, char, float, double etc.) depend upon your different types of data types. and compilersEXAMPLES#include#includeint main(){int i;char ch;float f;double d;long double l;printf("\nsize of integer is %d byte",sizeof(i));printf("\nsize of character is %d byte",sizeof(ch));printf("\nsize of float is %d byte",sizeof(f));printf("\nsize of double is %d byte",sizeof(d));printf("\nsize of long is %d byte",sizeof(l));getch();}Made by (ARUN KUMAR RAI).
use cout << simple
printf("%u %+d %+d",200,200,-200); //will print 200 +200 -200
try to usecondition ? value if true : value if falseor: if (printf ("Hello")) {}
printf(format_string, ...);
Printf function is used in c language. Printf is used to print something to the standard output. ex: printf ('welcome');
Your question makes no sense.
write, putchar, putc, fputc etc
#include<stdio.h> #include<conio.h> void main() { int i, a[100]; clrscr(); printf("Numbers from 1 to 100"); for(i=1;i<=100;i++) printf(" %d",a[i]); printf("Numbers from 1 to 100 without multiples of 2"); for(i=1;i<=100;i++) { if (a[i]%2 !=0) printf(" %d",a[i]); } printf("Numbers from 1 to 100 without multiples of 3"); for(i=1;i<=100;i++) { if (a[i]%3 !=0) printf(" %d",a[i]); } printf("Numbers from 1 to 100 without multiples of 4"); for(i=1;i<=100;i++) { if (a[i]%4 !=0) printf(" %d",a[i]); } printf("Numbers from 1 to 100 without multiples of 5"); for(i=1;i<=100;i++) { if (a[i]%5 !=0) printf(" %d",a[i]); } printf("Numbers from 1 to 100 without multiples of 6"); for(i=1;i<=100;i++) { if (a[i]%6 !=0) printf(" %d",a[i]); } printf("Numbers from 1 to 100 without multiples of 7"); for(i=1;i<=100;i++) { if (a[i]%7 !=0) printf(" %d",a[i]); } printf("Numbers from 1 to 100 without multiples of 8"); for(i=1;i<=100;i++) { if (a[i]%8 !=0) printf(" %d",a[i]); } printf("Numbers from 1 to 100 without multiples of 9"); for(i=1;i<=100;i++) { if (a[i]%9 !=0) printf(" %d",a[i]); } getch(); }
The printf() function prints a formatted string.
void PrintDist (double d) { printf ("the distance is %g", d); }