answersLogoWhite

0

How do you write numbers in printf?

Updated: 12/17/2022
User Avatar

Wiki User

11y ago

Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: How do you write numbers in printf?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a function in c to implement a pyramid of numbers?

for(i=1;i<=5;i++) { for(x=5;x>=i;x--) { printf(" "); } for(j=1;j<=2*i-1;j++) { printf("1"); } printf("\n"); }


How do you write a C program using an integer array to print array numbers up to 100 and then remove all numbers that are divisible by 2 and print out the remaining numbers and continue for 3 to 9?

#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(); }


How do you write maximum of two numbers in C programming?

#include<stdio.h> #include<conio.h> void main() { int a,b; clrscr(); printf("Enter two numbers"); scanf("%d,%d",&a,&b); if(a>b) { printf("%d is greater",a); } else { printf("%d is greater",b); } getch(); }


How do you write a c program to print words when numbers are given?

void print_num_as_word (unsigned num) { switch (num) { case 0: printf ("zero"); break; case 1: printf ("one"); break; case 2: printf ("two"); break; case 3: printf ("three"); break; case 4: printf ("four"); break; case 5: printf ("five"); break; case 6: printf ("six"); break; case 7: printf ("seven"); break; case 8: printf ("eight"); break; case 9: printf ("nine"); break; } }


Write a program in c for arithmetic operators by using switch case?

#include<stdio.h> #include<conio.h> void main() { int a,b,c; int menu; printf("choose the arithmetic option\n"); scanf("%d",&menu); switch(menu) { case 1: printf("Enter The Two Numbers:\n"); scanf("%d%d",&a,&b); c=a+b; printf("The addition of two numbers %d\n",c); break; case 2: printf("Enter THE TWO NUMBERS:\n"); scanf("%d%d",&a,&b); c=a-b; printf("The subtraction of two numbers %d\n",c); break; case 3: printf("Enter THE TWO NUMBERS:\n"); scanf("%d%d",&a,&b); c=a*b; printf("The multiplication of two numbers %d\n",c); break; case 4: printf("Enter THE TWO NUMBERS:\n"); scanf("%d%d",&a,&b); c=a/b; printf("The division of two numbers %d\n",c); break; } getch(); }


Write a shell script for addition of two numbers using expr?

a=10; b=20; c=`expr $a + $b`; printf "$c";


How do you write a C program to find the sum of two numbers with output?

#include<stdio.h> int main (void) { int a, b; printf("Enter two numbers: "); scanf ("%d %d", a, b); printf ("The sum of %d and %d is %d\n", a, b, a+b); return 0; }


Write a C program for multiplication of two complex numbers?

Answer: #include<stdio.h> #include<conio.h> main() { int a,b,i=1,c1,c2,m; clrscr(); printf("\nENTER THE VALUE OF a,b:"); scanf("d",&a,&b); c1=a+i*b; c2=a-i*b; printf("\n"); pritnf("\nTHE COMPLEX NUMBERS ARE:"); printf("\n); printf("a+ib=%d\ta-ib=%d",c1,c2); m=c1*c2; m=(a*a)+(b*b); printf("\n"); printf("\nTHE MUL OF TWO COMPLEX NUMBERS IS=%d",m); getch(); } Answer: z.real = x.real*y.real - x.imag*y.imag; z.imag = x.real*y.imag + x.imag*y.real;


How can we write our name in C programming language without using printf?

You can use fputs() instead of printf().


What is a purpose of printf and scanf statements?

we write printf() b/c it printf or show us the value contained in a value on the screen after pressing ctrl+f9.


Write a program of displaying numbers in shape of triangles by using looping?

#include <stdio.h> int main (void) { int i,j; for (i=1;i<5;i++) { for(j=1;j<=i;j++) printf("%d",j); printf("\n"); } return 0; }


Write a for loop in C to print the 7 stars row?

... int i; for( i = 0; i < 7; ++i ) { printf("*"); } printf("\n"); ...