{"id":83386,"date":"2021-08-07T09:00:32","date_gmt":"2021-08-07T03:30:32","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=83386"},"modified":"2021-08-07T09:00:32","modified_gmt":"2021-08-07T03:30:32","slug":"c-programs","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/c-programs\/","title":{"rendered":"Basic C Programs for Practice"},"content":{"rendered":"<p>With the help of the C programming language, we can solve various types of mathematical problems.In this tutorial, we are going to write some programs in C to solve mathematical problems like Fibonacci Series, Prime Numbers, Palindrome and Factorial of a number, Reverse of a number, Matrix multiplication and decimal to binary.<\/p>\n<h3>1. Fibonacci Series in C<\/h3>\n<p>In the Fibonacci series, the next number is the sum of the previous two numbers. And the first two numbers of the fibonacci series are 0 and 1.<\/p>\n<p><strong>Example:- 0,1,1,2,3,5,8,13 etc.<\/strong><\/p>\n<p>In two ways, you can implement fibonacci series:-<\/p>\n<ul>\n<li>Writing the code without recursion<\/li>\n<li>Writing the code with recursion<\/li>\n<\/ul>\n<h4>Algorithm:-<\/h4>\n<p>START<br \/>\nStep 1 \u2192 Take integer variable n1, n2, n3<br \/>\nStep 2 \u2192 Set n1 = 0, n2 = 0<br \/>\nStep 3 \u2192 DISPLAY n1, n2<br \/>\nStep 4 \u2192 n3 = n1 + n2<br \/>\nStep 5 \u2192 DISPLAY n3<br \/>\nStep 6 \u2192 Set n1 = n2, n2 = n3<br \/>\nStep 7 \u2192 REPEAT from 4 &#8211; 6, for n times<br \/>\nSTOP<\/p>\n<h4>Fibonacci Series Without recursion in C:-<\/h4>\n<p>You can implement fibonacci series without recursion in C. Below is the code to perform fibonacci series without recursion:-<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;stdio.h&gt;    \nint main()    \n{    \nint first=0,second=1,result,a,num=7;\nprintf(\"TechVidvan Tutorial: Fibonacci Series without recursion!\\n\");\nprintf(\"%d %d\",first,second);   \nfor(a=2;a&lt;num;++a)    \n{    \nresult=first+second;    \nprintf(\" %d\",result);    \nfirst=second;    \nsecond=result;    \n}  \nreturn 0;  \n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">TechVidvan Tutorial: Fibonacci Series without recursion!<br \/>\n0 1 1 2 3 5 8<\/div>\n<h4>Fibonacci Series with recursion in C:-<\/h4>\n<p>With the help of recursion, you can implement the fibonacci series in C. Below is the code to perform fibonacci series with recursion:-<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;stdio.h&gt;    \nvoid fib(int num){    \nstatic int first=0,second=1,result;    \nif(num&gt;0){    \nresult=first+second;    \nfirst=second;  \nsecond=result;  \nprintf(\"%d \",result);    \nfib(num-1);    \n}    \n}    \nint main(){    \nint num=7;   \nprintf(\"TechVidvan Tutorial: Fibonacci Series with Recursion in C!\\n\\n\");\nprintf(\"Fibonacci Series: \");    \nprintf(\"%d %d \",0,1);    \nfib(num-2);    \nreturn 0;  \n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">\n<p>TechVidvan Tutorial: Fibonacci Series with Recursion in C!<\/p>\n<p>Fibonacci Series: 0 1 1 2 3 5 8<\/p>\n<\/div>\n<h3>2. Find Prime Numbers in C Program:-<\/h3>\n<p>When a number is just divisible by 1 or itself and is greater than 1 is called a prime number.<\/p>\n<p><strong>NOTE:-<\/strong> Prime numbers are divisible by 1 or itself.<\/p>\n<p>Example:- 2,3,5,7,11,13 etc are prime numbers.<\/p>\n<p><strong>C Program to Check if a number is prime or not<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;stdio.h&gt;  \nint main(){    \nint num,a,res=0,count=0;   \nprintf(\"TechVidvan Tutorial: Check if a number is prime or not!\\n\\n\");\nprintf(\"Check this number: \\n\");    \nscanf(\"%d\",&amp;num);    \nres=num\/2;    \nfor(a=2;a&lt;=res;a++)    \n{    \nif(num%a==0)    \n{    \nprintf(\"The entered number '%d' is not prime!\",num);    \ncount=1;    \nbreak;\t \n}    \n}    \nif(count==0)    \nprintf(\"The entered number '%d' is prime!\",num);\t \nreturn 0;  \n}\t\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">\n<p>TechVidvan Tutorial: Check if a number is prime or not!<\/p>\n<p>Check this number:<br \/>\n23<br \/>\nThe entered number &#8217;23&#8217; is prime!<\/p>\n<\/div>\n<h3>3. Find if the number is Palindrome using C Programming<\/h3>\n<p>Suppose, a number is reversed. If the reversed number is the same as the original number then this number is called a palindrome number.<\/p>\n<h4>Algorithm:-<\/h4>\n<ul>\n<li>First, take an input number from the user.<\/li>\n<li>Then, hold the number in a temporary variable.<\/li>\n<li>After that, reverse the given number.<\/li>\n<li>Then, do a comparison between the reversed number and the temporary number.<\/li>\n<li>If both numbers are the same then display that it is a palindrome number.<\/li>\n<li>If not then display that it is not a palindrome number.<\/li>\n<\/ul>\n<p><strong>Example:- Palindrome Number<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;stdio.h&gt;  \nint main()    \n{    \nint num,reversed,sum=0,garbage;\nprintf(\"TechVidvan Tutorial: Palindrome number!\\n\");\nprintf(\"Please enter your number: \");    \nscanf(\"%d\",&amp;num);    \ngarbage=num;    \nwhile(num&gt;0)    \n{    \nreversed=num%10;    \nsum=(sum*10)+reversed;    \nnum=num\/10;    \n}    \nif(garbage==sum)    \nprintf(\"The entered number '%d' is palindrome!\",garbage);    \nelse    \nprintf(\"The entered number '%d' is not palindrome!\",garbage);   \nreturn 0;  \n}\n\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">TechVidvan Tutorial: Palindrome number!<br \/>\nPlease enter your number: 131<br \/>\nThe entered number &#8216;131&#8217; is palindrome!<\/div>\n<h3>4. Find Factorial of a number through C Program<\/h3>\n<p>Factorial of a number means the product of all positive descending integers. Factorial is denoted by \u2018!\u2019.<br \/>\nExample:-<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">5! = 5*4*3*2*1 = 120\n4! = 4*3*2*1 = 24<\/pre>\n<p>There are 2 ways to write the program for finding the factorial of a number.<\/p>\n<ul>\n<li>Finding factorial using loop<\/li>\n<li>Finding factorial using recursion<\/li>\n<\/ul>\n<h4>Find factorial of a number using loop:-<\/h4>\n<p>In C, you make use of loops to find the factorial of a number.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;stdio.h&gt;  \nint main()    \n{    \n int a,factorial=1,num;\n printf(\"TechVidvan Tutorial: Find the factorial of a number using a loop!\\n\");\n printf(\"Please enter the number: \");    \n  scanf(\"%d\",&amp;num);    \n  for(a=1;a&lt;=num;a++){    \n  \tfactorial=factorial*a;    \n  }    \n  printf(\"The factorial value of %d is: %d\",num,factorial);    \nreturn 0;  \n}<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">TechVidvan Tutorial: Find the factorial of a number using a loop!<br \/>\nPlease enter the number: 5<br \/>\nThe factorial value of 5 is: 120<\/div>\n<h4>Find factorial of a number using recursion:-<\/h4>\n<p>In C, you also calculate the factorial of a number using recursion.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;stdio.h&gt;  \nint fact(int num)  \n{  \n  if (num == 0)  \n  return 1;  \n  else  \n  return(num * fact(num-1));  \n}  \n   \nint main()  \n{  \n  int num;  \n  int factorial;\n  printf(\"TechVidvan Tutorial: Finding the factorial of a number using recursion!\\n\");\n  printf(\"Please enter a number: \");  \n  scanf(\"%d\", &amp;num);   \n   \n  factorial = fact(num);\n  printf(\"The factorial value of %d is %d\\n\", num, factorial);  \n  return 0;  \n}\n\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">TechVidvan Tutorial: Finding the factorial of a number using recursion!<br \/>\nPlease enter a number: 5<br \/>\nThe factorial value of 5 is 120<\/div>\n<h3>5. Reverse a number using C:-<\/h3>\n<p>In C, there are many ways to reverse a number. You can reverse a number using loops and recursion.<\/p>\n<h4>Algorithm:-<\/h4>\n<p>You have to use modulus(%) to reverse a number.<\/p>\n<ul>\n<li>First, you have to initialize a reverse number to 0.<\/li>\n<li>Then, multiply the reverse with value 10.<\/li>\n<li>After that, divide the given number by 10 and find the modulus.<\/li>\n<li>Then, add the modulus and the reverse number.<\/li>\n<li>Display the result of addition.<\/li>\n<li>Divide a given number by 10.<\/li>\n<li>Then, repeat the steps from second to sixth until you get the output.<\/li>\n<\/ul>\n<h4>Reverse a number using while loop:-<\/h4>\n<p>Following is the code to reverse a number using a while loop.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;stdio.h&gt;\n#include&lt;conio.h&gt;\nint main()\n{\nint num, reverse = 0;\nprintf(\"TechVidvan Tutorial: Reverse a number using the while loop!\\n\");\nprintf(\"Enter a number to reverse: \");\nscanf(\"%d\", &amp;num);\nwhile (num != 0)\n{\nreverse = reverse * 10;\nreverse = reverse + num % 10;\nnum = num \/ 10;\n}\nprintf(\"The reverse value of the entered number is: %d\", reverse);\nreturn 0;\n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">TechVidvan Tutorial: Reverse a number using the while loop!<br \/>\nEnter a number to reverse: 22114456<br \/>\nThe reverse value of the entered number is: 65441122<\/div>\n<h4>Reverse a number using recursion:-<\/h4>\n<p>Following is the program to reverse a number using recursion:-<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;stdio.h&gt;\n#include&lt;conio.h&gt;\nint reverse_number(int);\nint main()\n{\nint num, reverse = 0;\nprintf(\"TechVidvan Tutorial: Reverse a number using recursion!\\n\\n\");\nprintf(\"Please enter a number to reverse:\");\nscanf(\"%d\", &amp;num);\nreverse = reverse_number(num);\nprintf(\"The reverse value of the number is: %d\", reverse);\nreturn 0;\n}\nreverse_number(int num)\n{\nstatic reverse = 0;\nif (num == 0)\nreturn 0;\nreverse = reverse * 10;\nreverse = reverse + num % 10;\nreverse_number(num\/10);\nreturn reverse;\n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">\n<p>TechVidvan Tutorial: Reverse a number using recursion!<\/p>\n<p>Please enter a number to reverse:236498<br \/>\nThe reverse value of the number is: 894632<\/p>\n<\/div>\n<h4>Reverse a number using for loop:-<\/h4>\n<p>In this, we first initialised and declared variables. Then, we put the condition in the program. If the condition is true then the code within the for block will get executed. And if it is false then it will exit out of the for block. After that the increment statement will get executed. Then, the condition will be checked. If it is true then the for block will execute again.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;stdio.h&gt;\n#include&lt;conio.h&gt;\nint main()\n{\nint num, remain, reverse=0, a;\nprintf(\"TechVidvan Tutorial: Reverse a number using the for loop!\\n\\n\");\nprintf(\"Enter a number to reverse: \");\nscanf(\"%d\", &amp;num);\nfor(a = num; a &gt;0; )\n{\nremain = a % 10;\nreverse = remain + reverse * 10;\na = a\/ 10;\n}\nprintf(\"The reverse value of the entered number is: %d\", reverse);\nreturn 0;\n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">\n<p>TechVidvan Tutorial: Reverse a number using the for loop!<\/p>\n<p>Enter a number to reverse: 3664921<br \/>\nThe reverse value of the entered number is: 1294663<\/p>\n<\/div>\n<h4>Reverse a number using do-while loop:-<\/h4>\n<p>It is much like the while loop. But it gets executed at least one time in the do-while loop.<br \/>\nThe condition is set to at the end of the loop. And the statements inside the do-while loop gets executed before checking if the condition is true or false.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;stdio.h&gt;\n#include&lt;conio.h&gt;\nint main()`\n{\nint num, reverse = 0;\nprintf(\"TechVidvan Tutorial: Reverse a number using a do-while loop!\\n\\n\");\nprintf(\"Enter a number to reverse: \");\nscanf(\"%d\", &amp;num);\ndo\n{\nreverse = reverse * 10;\nreverse = reverse + num % 10;\nnum = num \/ 10;\n}while(num != 0);\nprintf(\"The reverse value of the number is: %d\", reverse);\nreturn 0;\n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">\n<p>TechVidvan Tutorial: Reverse a number using a do-while loop!<\/p>\n<p>Enter a number to reverse: 23645869<br \/>\nThe reverse value of the number is: 96854632<\/p>\n<\/div>\n<h3>6. Matrix Multiplication using C Language<\/h3>\n<p>In C, we can add, subtract, multiply one, two or three dimensional matrices. To do these operations, you have to take input from the user for row number, column number and matrix elements. After that, you can perform matrix multiplication.<\/p>\n<p>Following is an example of multiplying of 2*2 and 3*3 matrices:-<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;stdio.h&gt;    \n#include&lt;stdlib.h&gt;  \nint main(){  \nint m1[10][10],m2[10][10],multiple[10][10],row,column,a,b,c;    \nprintf(\"TechVidvan Tutorial: Multiplying matrices in C!\\n\\n\");\nprintf(\"Please enter the number of rows: \");    \nscanf(\"%d\",&amp;row);    \nprintf(\"Please enter the number of columns: \");    \nscanf(\"%d\",&amp;column);    \nprintf(\"Please enter the elements of first matrix:\\n\");    \nfor(a=0;a&lt;row;a++)    \n{    \nfor(b=0;b&lt;column;b++)    \n{    \nscanf(\"%d\",&amp;m1[a][b]);    \n}    \n}    \nprintf(\"Please enter the elements of second matrix:\\n\");    \nfor(a=0;a&lt;row;a++)    \n{    \nfor(b=0;b&lt;column;b++)    \n{    \nscanf(\"%d\",&amp;m2[a][b]);    \n}    \n}    \n    \nprintf(\"Multiplying the two matrices:\\n\");    \nfor(a=0;a&lt;row;a++)    \n{    \nfor(b=0;b&lt;column;b++)    \n{    \nmultiple[a][b]=0;    \nfor(c=0;c&lt;column;c++)    \n{    \nmultiple[a][b]+=m1[a][b]*m2[c][b];    \n}    \n}    \n}    \n \nfor(a=0;a&lt;row;a++)    \n{    \nfor(b=0;b&lt;column;b++)    \n{    \nprintf(\"%d\\t\",multiple[a][b]);    \n}    \nprintf(\"\\n\");    \n}    \nreturn 0;  \n}<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">\n<p>TechVidvan Tutorial: Multiplying matrices in C!<\/p>\n<p>Please enter the number of rows: 2<br \/>\nPlease enter the number of columns: 2<br \/>\nPlease enter the elements of first matrix:<br \/>\n144<br \/>\n1<br \/>\n2<br \/>\n35<br \/>\nPlease enter the elements of second matrix:<br \/>\n12<br \/>\n35<br \/>\n4<br \/>\n5<br \/>\nMultiplying the two matrices:<br \/>\n2304 40<br \/>\n32 1400<\/p>\n<\/div>\n<h3>7. Convert decimal to binary using C Programming<\/h3>\n<p>In C, you can convert a decimal value to a binary value or vice-versa.<\/p>\n<h4>Decimal Number:-<\/h4>\n<p>It is specially known as a base 10 number. It ranges from 0 to 9.<\/p>\n<p>Example:- 23, 6,78,90 etc.<\/p>\n<p>Decimals are also defined as a combination of digits.<\/p>\n<h4>Binary Number:-<\/h4>\n<p>It is either 1 or 0. It is a base 2 number. Combination of 0 and 1\u2019s such as 001,110,1110 etc.<br \/>\nFollowing is the table of binary values for the decimal numbers.<\/p>\n<table style=\"height: 653px\" width=\"452\">\n<tbody>\n<tr>\n<td><b>Decimal<\/b><\/td>\n<td><b>Binary<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">1<\/span><\/td>\n<td><span style=\"font-weight: 400\">1<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">2<\/span><\/td>\n<td><span style=\"font-weight: 400\">10<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">3<\/span><\/td>\n<td><span style=\"font-weight: 400\">11<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">4<\/span><\/td>\n<td><span style=\"font-weight: 400\">100<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">5<\/span><\/td>\n<td><span style=\"font-weight: 400\">101<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">6<\/span><\/td>\n<td><span style=\"font-weight: 400\">110<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">7<\/span><\/td>\n<td><span style=\"font-weight: 400\">111<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">8<\/span><\/td>\n<td><span style=\"font-weight: 400\">1000<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">9<\/span><\/td>\n<td><span style=\"font-weight: 400\">1001<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">10<\/span><\/td>\n<td><span style=\"font-weight: 400\">1010<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Algorithm for converting decimal to binary:-<\/h3>\n<ul>\n<li>First, you have to divide the number by 2 using modulus(%) and then store the remainder in an array.<\/li>\n<li>Then, you have to again divide the number by 2 using division operator(\/).<\/li>\n<li>Then, Repeat the above steps until the number is greater than 0.<\/li>\n<\/ul>\n<p><strong>Example:- Converting decimal to binary<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;stdio.h&gt;    \n#include&lt;stdlib.h&gt;  \nint main()\n{  \nint arr[10],num,a;    \nprintf(\"TechVidvan Tutorial: Converting decimal to binary in C!\\n\\n\");\nprintf(\"Please enter the number which you want to convert: \");    \nscanf(\"%d\",&amp;num);  \nprintf(\"Binary value of the number %d is: \",num);  \nfor(a=0;num&gt;0;a++)    \n{    \narr[a]=num%2;    \nnum=num\/2;    \n}    \n \nfor(a=a-1;a&gt;=0;a--)    \n{    \nprintf(\"%d\",arr[a]);    \n}    \nreturn 0;  \n}\n\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">\n<p>TechVidvan Tutorial: Converting decimal to binary in C!<\/p>\n<p>Please enter the number which you want to convert: 12<br \/>\nBinary value of the number 12 is: 1100<\/p>\n<\/div>\n<h3>Summary<\/h3>\n<p>In this tutorial, we perform some mathematical operations using loops, recursion etc. We wrote a program to convert a decimal number to a binary number and performed multiplication on matrices. We wrote a program to find the factorial of a number in C. Then we also wrote programs to reverse a number, find the palindrome of a number, check if the number is prime or not. We discussed how we can implement the fibonacci series in C.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With the help of the C programming language, we can solve various types of mathematical problems.In this tutorial, we are going to write some programs in C to solve mathematical problems like Fibonacci Series,&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":83442,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3510],"tags":[3951,3952,3953,3954,3955,3956,3957],"class_list":["post-83386","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c-programming","tag-c-programs","tag-factorial-of-number-in-c","tag-fibonacci-series-in-c","tag-important-c-programs","tag-palindrome-program-in-c","tag-prime-numbers-in-c","tag-programs-in-c"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Basic C Programs for Practice - TechVidvan<\/title>\n<meta name=\"description\" content=\"Learn how to write basic C Programs that are important and asked in various Interviews like Fibonacci series in C, find prime numbers using C\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/c-programs\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Basic C Programs for Practice - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Learn how to write basic C Programs that are important and asked in various Interviews like Fibonacci series in C, find prime numbers using C\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/c-programs\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-07T03:30:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/07\/C-programs.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Basic C Programs for Practice - TechVidvan","description":"Learn how to write basic C Programs that are important and asked in various Interviews like Fibonacci series in C, find prime numbers using C","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/c-programs\/","og_locale":"en_US","og_type":"article","og_title":"Basic C Programs for Practice - TechVidvan","og_description":"Learn how to write basic C Programs that are important and asked in various Interviews like Fibonacci series in C, find prime numbers using C","og_url":"https:\/\/techvidvan.com\/tutorials\/c-programs\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2021-08-07T03:30:32+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/07\/C-programs.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/c-programs\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/c-programs\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Basic C Programs for Practice","datePublished":"2021-08-07T03:30:32+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/c-programs\/"},"wordCount":1228,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/c-programs\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/07\/C-programs.jpg","keywords":["C programs","Factorial of number in C","Fibonacci series in C","Important C Programs","Palindrome Program in C","Prime numbers in C","Programs in C"],"articleSection":["C Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/c-programs\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/c-programs\/","url":"https:\/\/techvidvan.com\/tutorials\/c-programs\/","name":"Basic C Programs for Practice - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/c-programs\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/c-programs\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/07\/C-programs.jpg","datePublished":"2021-08-07T03:30:32+00:00","description":"Learn how to write basic C Programs that are important and asked in various Interviews like Fibonacci series in C, find prime numbers using C","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/c-programs\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/c-programs\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/c-programs\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/07\/C-programs.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/07\/C-programs.jpg","width":1200,"height":628,"caption":"C programs"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/c-programs\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Basic C Programs for Practice"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/83386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=83386"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/83386\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/83442"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=83386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=83386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=83386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}