How To Write a C Program To Print Table Of n And Square Of n Using pow() in C Programming Language ?
Solution For C Program To Print Table of n and Square of n:#include<stdio.h> #include<conio.h> void main() { int n; printf("Not Square"); printf("-----------------n"); for(n=1;n <=10;n++) printf("%d\t%d\n",n,n*n); getch(); }Output :No Square ------------- 1 1 2 4 3 9 4 16 5 25 6 36 7 49 8 64 9 81 10 100
We can alternately write above program like this -
printf("%d\t%d\n",n,pow(n,2));
In order to use above line in the code we need to include math.h header file inside C program.
#include<math.h>
Solution For C Program To Print Table Of n And Square Of n Using pow():
#include<stdio.h> #include<conio.h> #include<math.h> void main() { int n; printf("Not Square\n"); printf("-----------------n"); for(n=1;n <=10;n++) printf("%d\t%d\n",n,pow(n,2)); getch(); }
Tags: C Program to print table of n and square of n using pow(), C program to find power of a number using pow() Function, C Program to print table of n and square of n using pow().
Learn More :
C Program
- Using Bash to input stuff into c program
- Difficult C Programming Questions
- Write a c program to find largest among three numbers using binary minus operator three numbers using binary minus operator
- PRINTING ASCII VALUE USING C PROGRAM
- MULTIPLICATION OF TWO MATRICES USING C PROGRAM
- FIND OUT SUM OF DIAGONAL ELEMENTS OF A MATRIX USING
- Write A C Program To Find Out Transport Of A Matrix
- Factorial of 100 in C Program
- Multiplication of large numbers in c
- Division of Large Numbers in C Program
- BINARY SEARCH USING C PROGRAM
- BINARY SEARCH THROUGH RECURSION USING C PROGRAM
- FIND FACTORIAL OF A NUMBER USING RECURSION IN C PROGRAM
- FIND GCD OF A NUMBER USING RECURSION IN C PROGRAM
- FIND SUM OF DIGITS OF A NUMBER USING RECURSION USING C PROGRAM
- FIND POWER OF A NUMBER USING RECURSION USING C PROGRAM
- REVERSE A NUMBER USING RECURSION IN C PROGRAM
- SWAP TWO VARIABLES WITHOUT USING THIRD USING C PROGRAM VARIABLE
- Write A C Program For Swapping Of Two Arrays
- SWAPPING OF STRINGS USING C PROGRAM
- CONVERSION FROM DECIMAL TO OCTAL USING C PROGRAM
- CONVERSION FROM DECIMAL TO OCTAL USING C PROGRAM
- CONVERSION OF DECIMAL TO BINARY USING C PROGRAM
- CONVERSION OF FAHRENHEIT TO CENTIGRADE USING C PROGRAM
- C or C++ Program To Find Bonus Amount