Posts

Showing posts from 2020

Games

Angry birds

Program to show present time and date in C-language

Program to show present time and date in C-language. #include <stdio.h> #include <string.h> int main() {   char time[10];   char date[12];   strcpy(time, __TIME__);   strcpy(date, __DATE__);   printf("%s %s\n", time, date);      return 0; } OUTPUT 08:17:09 May 25 2020 The above time and date change according to you when you run the program,So it show different time. If you like this program you can share comments and follow.

Binary searching in C-language

Program to search an element using binary search. #include<stdio.h> int main() {     int i,a[10],n,b,c=0,l,f,mid;     printf("Enter the size limit maximum is 10\n");     scanf("%d",&n);     printf("Enter the array element\n");     for(i=0;i<n;i++)     {         scanf("%d",&a[i]);     }     printf("Enter the element to be searched\n");     scanf("%d",&b);     f=0;     l=n-1;     while(f<=l)     {         mid=(f+l)/2;         if(b<a[mid])         {             l=mid-1;         }         if(b>a[mid])         {             f=mid+1;         }         else if(b==a[mid])         {             c=1;             break;         }     }     if(c==0)     {         printf("Element not found");     }     else     {         printf("Element found at %d position",mid+1);     }     } OUTPUT Enter the size limit maximum is 10 4 Enter array element 4 6 3 9 Enter the element to be searched 6 Element

Linear search in C-language

Program to search an element in an array and position in that element and no duplicate element exit in C-language #include<stdio.h> int main() {     int i,a[10],n,b,c=0;     printf("Enter the size limit maximum is 10\n");     scanf("%d",&n);     printf("Enter the array element\n");     for(i=0;i<n;i++)     {         scanf("%d",&a[i]);     }     printf("Enter the element to be searched\n");     scanf("%d",&b);     for(i=0;i<n;i++)     {         if(b==a[i])         {             c++;             printf("Element found at position %d\n",i+1);             break;         }     }     if(c==0)     {         printf("Element not found");     }     } OUTPUT Enter the size limit maximum is 10 4 Enter the array element 8 7 8 56 Enter the element to be searched 8 Element found at position 1

Linear search in C-language

Program to search an element in an array also print the occurrence and position of that elements in C-language. #include<stdio.h> int main() {     int i,a[10],n,b,c=0;     printf("Enter the size limit maximum is 10\n");     scanf("%d",&n);     printf("Enter the array element\n");     for(i=0;i<n;i++)     {         scanf("%d",&a[i]);     }     printf("Enter the element to be searched\n");     scanf("%d",&b);     for(i=0;i<n;i++)     {         if(b==a[i])         {             c++;             printf("Element found at position %d\n",i+1);         }     }     if(c==0)     {         printf("Element not found");     }     else         {         printf("Element is found %d times",c);     }     } OUTPUT Enter the size limit maximum is 10 4 Enter the array element 6 4 6 7 Enter element to be searched 6 Element found at position 1 Element found at position 3 Element is found 2 times

Linear search in C-language

Program to search an element from an array also print the occurrence of that particular element in C-language. #include<stdio.h> int main() {     int i,a[10],n,b,c=0;     printf("Enter the size limit maximum is 10\n");     scanf("%d",&n);     printf("Enter the array element\n");     for(i=0;i<n;i++)     {         scanf("%d",&a[i]);     }     printf("Enter the element to be searched\n");     scanf("%d",&b);     for(i=0;i<n;i++)     {         if(b==a[i])         {             c++;         }     }     if(c==0)     {         printf("Element not found");     }     else         {         printf("Element is found %d times",c);     }     } OUTPUT Enter the size limit maximum is 10 4 Enter the array element 3 2 3 8 Enter the array element to be searched 3 Element is found 2 times

Program to reverse one array into other array in C-language

Program to reverse one array into other array in C-language #include<stdio.h> int main() {     int i,a[10],n,b[10];     printf("Enter the size limit maximum is 10\n");     scanf("%d",&n);     printf("Enter the array element\n");     for(i=0;i<n;i++)     {         scanf("%d",&a[i]);     }     for(i=0;i<n;i++)     {         b[n-1-i]=a[i];     }     printf("Reverse of array is\n");     for(i=0;i<n;i++)     {       printf("%d ",b[i]);     }     } OUTPUT Enter the size limit maximum is 10 4 Enter the array element 1 2 3 4 Reverse of array element is 4 3 2 1

Program to find the sum of two array into the third in C-language

Program to find the sum of two array into the third in C-language #include<stdio.h> int main() {     int i,a[10],n,b[10],c[10];     printf("Enter the size limit maximum is 10\n");     scanf("%d",&n);     printf("Enter the First array element\n");     for(i=0;i<n;i++)     {         scanf("%d",&a[i]);     }     printf("Enter the second array element\n");   for(i=0;i<n;i++)     {         scanf("%d",&b[i]);     }     printf("Sum of array is\n");     for(i=0;i<n;i++)     {         c[i]=a[i]+b[i];         printf("%d ",c[i]);     }          } OUTPUT Enter the size limit maximum is 10 4 Enter the First array element 12 3 4 6 Enter the second array element 6 5 4 3 Sum of array is 18 8 8 9

Program to find maximum and minimum elements in an array in C-language

Program to find maximum and minimum elements in an array in C-language #include<stdio.h> int main() {     int i,a[10],n,min,max=0;     printf("Enter the size limit maximum is 10\n");     scanf("%d",&n);     printf("Enter the array element\n");     for(i=0;i<n;i++)     {         scanf("%d",&a[i]);     }     min=a[0];     for(i=0;i<n;i++)     {        if(max<a[i])         {             max=a[i];         }         else if(min>a[i])         {             min=a[i];         }     }     printf("Maximum is  %d minimum is %d",max,min);     } OUTPUT Enter the size limit maximum is 10 4 Enter the array element 6 9 0 1 Maximum is 9 minimum is 0

Program to find the sum of all n elements in an array in C-language

Program to find the sum of all n elements in an array in C-language #include<stdio.h> int main() {     int i,a[10],n,sum=0;     printf("Enter the size limit maximum is 10\n");     scanf("%d",&n);     printf("Enter the array element\n");     for(i=0;i<n;i++)     {         scanf("%d",&a[i]);     }     printf(" Sum of Array element is\n");     for(i=0;i<n;i++)     {         sum=sum+a[i];     }     printf("  %d ",sum);      } OUTPUT Enter the size limit maximum is 10 4 Enter the array element 1 4 3 2 Sum of Array element is 10

Program to input an array elements and then display the same array in C-language

Program to input an array elements and then display the same array in C-language #include<stdio.h> int main() {     int i,a[10],n;     printf("Enter the size limit maximum is 10\n");     scanf("%d",&n);     printf("Enter the array element\n");     for(i=0;i<n;i++)     {         scanf("%d",&a[i]);     }     printf("Array element are\n");     for(i=0;i<n;i++)     {         printf("%d ",a[i]);     } } OUTPUT Enter the size limit maximum is 10 4 Enter the array element 4 7 8 0 Array element are 4 7 8 0

Creative Pattern of Rhino in C-language

Image
Creative Pattern of Rhino in C-language #include<stdio.h> int main() {     printf("\t\t                               ,-.             __\n");     printf("\t\t                             ,\'   `---.___.---\'  `.\n");     printf("\t\t                           ,\'   ,-                 `-._\n");     printf("\t\t                         ,\'    /                       \\\n");     printf("\t\t                      ,\\/     /                        \\\\\n");     printf("\t\t                  )`._)>)     |                         \\\\\n");     printf("\t\t                  `>,\'    _   \\                  /       |\\\n");     printf("\t\t                    )      \\   |   |            |        |\\\\\n");     printf("\t\t           .   ,   /        \\  |    `.          |        | ))\n");     printf("\t\t           \\`. \\`-\'          )-|      `.   

Creative pattern of butterfly in C-language

Image
Creative pattern of butterfly in C-language #include<stdio.h> main() {     printf("\t\t\t\t                `         \'\n");     printf("\t\t\t\t;,,,             `       \'             ,,,;\n");     printf("\t\t\t\t`YES8888bo.       :     :       .od8888YES\'\n");     printf("\t\t\t\t  888IO8DO88b.     :   :     .d8888I8DO88\n");     printf("\t\t\t\t  8LOVEY\'  `Y8b.   `   \'   .d8Y\'  `YLOVE8\n");     printf("\t\t\t\t jTHEE!  .db.  Yb. \'   \' .dY  .db.  8THEE!\n");     printf("\t\t\t\t   `888  Y88Y    `b ( ) d\'    Y88Y  888\'\n");     printf("\t\t\t\t    8MYb  \'\"        ,\',        \"\'  dMY8\n");     printf("\t\t\t\t   j8prECIOUSgf\"\'   \':'   `\"?g8prECIOUSk\n");     printf("\t\t\t\t     \'Y\'   .8\'     d\' \'b     \'8.   \'Y\'\n"

Variable & Datatype for C-programming

Variable & Datatype for C-programming                                   5 Variable:- Whose value change is known as variable.You can use some specific variable. Ex:-a,b,c        A,B,C        a1,b2 But 1a,2b, space, special character are  not allowed. Underscore is allowed. Datatype:- Before declaration variable you need to define the type of variable i.e. integer, character, float etc Variable declaration:- You can define a variable in following way. Syntax:- datatype  variablename; Eg:-int x;        int a;        float q; Variable intialization:- In this step you have to give the value of variable. During character intialization write character within the '   ' Eg:-int x=1; or int x; x=1;       Datatype:- Datatype definition the nature of variable. It is mainly three types. 1.Integer 2.Character 3.Float 1.Integer datatype:- It represent integer value. And expressed as %d; Data Type      Size in bytes

Syntax of C-language

      Syntax of C-programming                                4. A C program is divided into different sections. There are six main sections to a basic c program.  The six sections are, Documentation Link Definition Global Declarations Main functions Subprograms 1. Documentation:- The documentation section is the part of the program where the programmer gives the details associated with the program. He usually gives the name of the program, the details of the author and other details like the time of coding and description. It gives anyone reading the code the overview of the code. 2.Link Section:- This part of the code is used to declare all the header files that will be used in the program. This leads to the compiler being told to link the header files to the system libraries. 3.Definition Section:- In this section, we define different constants. The keyword define is used in this part. 4.Global Declaration Section:- This part of th

Errors in C-language

                                      3. Errors in C-language Syntax error Logical error Math error Run time error Linker error Semantic error 1.Syntax error:-                                If any changes made in the predefined format of a c-language then the error is called  syntax error. Eg:- If semicolon missing or printf,scanf or other keyword are missing comes under syntax error. 2.Logical error:-                                   This error occurs when the user gets and an unaccepted output. Eg:- If the program is expected to give the output in real number but we are getting the output in integer. 3.Math error:-                             This error occurs because of the illegal input. Eg:- An number divided by zero is illegal modulus  operator  will not work for floating value. 4.Run time error:-                                    An error occurs at a time of exception is known as run time error. Eg:- In the syntax of scanf & i

Language Translator of C-language

                                       2.               Language Translator 1. Assembler 2. Compiler 3. Interpreter 4. Linker 5. Loader 1.Assembler:-   In computer science, assembler is a program which convert assembly level language into machine level language, because computer understand binary language.                          Machine code                                     ⬆️                                     ⬆️                               Assembler                                     ⬆️                                     ⬆️                    Assembly Level language 2. Compiler:-  Compiler turns the high level language to binary language or machine code at only one time is known as compiler.  3.Interpreter:- An  is also a program like compiler it convert assembly language to binary language but an interpreter goes one line of  a code a at time. 4.Linker:-   linker is used to link multiple obj files to create an executable file

Introduction of C-language.

Image
              Introduction of C-language                                           1. C-language was developed by  Dennis Ritchie  . In the year  1972  in  Bell Laboratory  in  USA  . C language suitable for system programmings ,it was mainly developed for  UNIX operating system . Dennis Ritchie (1941-2011) Books:-   The C Programming languages Dennis Ritchie also known as father of C-language.                         Use of C-language  ๐Ÿ‘‰๐ŸฟOperating system.  ๐Ÿ‘‰๐ŸฟLanguage Compiler.  ๐Ÿ‘‰๐ŸฟText editor.  ๐Ÿ‘‰๐ŸฟModern Program.  ๐Ÿ‘‰๐ŸฟDatabase.  ๐Ÿ‘‰๐ŸฟLanguage interpreter.  ๐Ÿ‘‰๐ŸฟMobile & desktop application.  ๐Ÿ‘‰๐Ÿฟ Gaming & Animation.                Features of C-language ๐Ÿ‘‰๐Ÿฟ Compiler based. ๐Ÿ‘‰๐ŸฟCase sensitive. ๐Ÿ‘‰๐Ÿฟ Simple & Powerful. ๐Ÿ‘‰๐Ÿฟ Syntax based. ๐Ÿ‘‰๐Ÿฟ Structure oriented. ๐Ÿ‘‰๐Ÿฟ Middle level. After reading this article you will be able to know about C-language, features,use of c-language,and more things related to C-l

Program to convert decimal to binary using while loop in C-language

#include<stdio.h> int main() {     int a,b,f;     printf("Enter the decimal number\n");     scanf("%d",&a);     printf("Binary of %d is\n",a);     while(a>0)     {         b=a%2;         a=a/2;               f=f*10+b;     }     printf("%d",f); } OUTPUT Enter the decimal number 15 Binary of 15 is 1111 Visit Homepage

Program to convert binary to decimal using while loop in C-language

#include<stdio.h> #include<math.h> int main() {     int a,b,c=0,f=0;     printf("Enter the binary number\n");     scanf("%d",&a);     printf("Decimal of %d is\n",a);     while(a!=0)     {         b=a%10;         a=a/10;         f=f+pow(2,c)*b;         c++;     }     printf("%d",f); } OUTPUT Enter the binary number 1011 Decimal of 1011 is 11

Program to print minimum digit of a number using while loop in C-language

#include<stdio.h> int main() {     int a,n,min;     printf("Enter the number\n");     scanf("%d",&n);     min=n%10;     while(n!=0)     {         a=n%10;         n=n/10;         if(min>a)         {             min=a;         }     }     printf("Lowest digit=%d",min);     } OUTPUT Enter the number 874805 Lowest digit=0

Program to print maximum digit of a number using while loop in C-language

#include<stdio.h> int main() {     int a,n,max=0;     printf("Enter the number\n");     scanf("%d",&n);     while(n!=0)     {         a=n%10;         n=n/10;         if(max<a)         {             max=a;         }     }     printf("Greatest digit=%d",max);     } OUTPUT Enter the number 89058 Greatest digit=9

Program to print all three digit Armstrong number using while loop in C-language

#include<stdio.h> #include<math.h> int main() { int i,a,p=0,k; for(i=100;i<1000;i++)     {     k=i;     p=0; while(k!=0) { a=k%10; k=k/10;     p=p+pow(a,3);    } if(p==i)     {         printf("%d ",i);     }     } } OUTPUT 153 370 371 407

Program to print all three digit Palindrome number using while loop in C-language

Image
#include<stdio.h> int main() { int i,a,rev=0,k; for(i=100;i<1000;i++)     {     k=i;     rev=0; while(k!=0) { a=k%10; k=k/10;     rev=rev*10+a;  } if(rev==i)     {         printf("%d ",i);     }     } } OUTPUT

Program to cheque enter number is Palindrom or not using while loop in C-language

#include<stdio.h> int main() { int n,a,f,rev=0,k; printf("Enter any number\n"); scanf("%d",&n);     k=n; while(n!=0) { a=n%10; n=n/10;     rev=rev*10+a;    } if(rev==k)     {         printf("Palindrome");     }     else     {         printf("Not Palindrome");     } } OUTPUT Enter any number 2332 Palindrome

Program to print First and last digit of a number using while loop in C-language

#include<stdio.h> int main() { int n,a,f; printf("Enter any number\n"); scanf("%d",&n);     f=n%10; while(n!=0) { a=n%10; n=n/10; } printf("First digit=%d\nLast digit=%d",a,f); } OUTPUT Enter any number 5687 First digit=5 Last digit=7

Program to print product of digit using while loop in C-language

#include<stdio.h> int main() {     int n,a,p=0;     printf("Enter the number\n");     scanf("%d",&n);     while(n!=0)     {         a=n%10;         n=n/10;     p=p+a;     }     printf("Sum of digit=%d",p); } OUTPUT Enter the number 456 Sum of digit=15 Visit Homepage

Program to print product of digit using while loop in C-language

#include<stdio.h> int main() {     int n,a,p=1;     printf("Enter the number\n");     scanf("%d",&n);     while(n!=0)     {         a=n%10;         n=n/10;      p=p*a;     }     printf("Product of digit=%d",p); } OUTPUT Enter the number 1234 Product of digit=24

Program to print reverse order of a number using while loop in C-language

#include<stdio.h> int main() {     int n,a;     printf("Enter the number\n");     scanf("%d",&n);     printf("Reverse order is\n");     while(n!=0)     {         a=n%10;         n=n/10;      printf("%d",a);     } } OUTPUT Enter the number 5678 Reverse order is 8765

Program to print number of digit in a number using while loop in C-language

#include<stdio.h> int main() {     int i=0,n,a;     printf("Enter the number\n");     scanf("%d",&n);     while(n!=0)     {         a=n%10;         n=n/10;         i++;      }     printf("Number of digit=%d",i); } OUTPUT Enter the number 46378 Number of digit=5 Visit Homepage

Program to print table of any number using while loop in C-language.

#include<stdio.h> int main() {     int i=1,n;     printf("Enter the number\n");     scanf("%d",&n);     printf("Table of %d is\n",n);     while(i<=10)     {         printf("%d*%d=%d\n",n,i,n*i);         i++;           } } OUTPUT Enter the number 5 Table of 5 is 5*1=5 5*2=10 5*3=15 5*4=20 5*5=25 5*6=30 5*7=35 5*8=40.      5*9=45 5*10=50 Visit Homepage

Program to print natural number from 1 to n using while loop in C-language

#include<stdio.h> int main() {     int i=1,n;     printf("Enter the last number\n");     scanf("%d",&n);     printf("All natural number from 1 to %d is\n",n);     while(i<=n)     {         printf("%d ",i);         i++;           } } OUTPUT Enter the last number 8 All natural number from 1 to 8 is 1 2 3 4 5 6 7 8 Visit Homepage

Program to cheque enter number is a perfect number or not using if else in C-language

Program to cheque enter number is a perfect number or not in C-language #include<stdio.h> int main() {     int a,i,s=0;     printf("Enter the number\n");     scanf("%d",&a);     for(i=1;i<a;i++)     {         if(a%i==0)         {             s=s+i;         }     }     if(s==a)     {         printf("Enter number is perfect number");     }     else     {         printf("Enter number is not perfect number");     } } OUTPUT Enter the number 28 Enter number is perfect number This program help you to cheque enter number is perfect number or not and also this program help you to make logics of coming program. If you like this program then you can share it and for any issues you can direct contact with me from  Home Page . For regular updates you can also follow my site. Visit Homepage

Program to see ASCII symbol by entering number in C-language

Program to see ASCII symbol by entering number in C-language #include<stdio.h> int main() { char i;     printf("Enter any number\n");     scanf("%d",&i);     printf("ASCII symbol=%c ",i); } OUTPUT Enter any number 123 ASCII symbol={ By using this program you can see symbol and ASCII  value . This small program further implement to see all ASCII Value  if you want see all ASCII the  Click If you like this program then you can share it and for any issues you can direct contact with me from  Home Page . For regular updates you can also follow my site. Visit Homepage

Program to see all ASCII value using for loop in C-language

Image
Program to see all ASCII value using for loop in C-language #include<stdio.h> int main() { char i;     printf("All ASCII values are\n");     for(i=32;i<=127;i++)     {         printf("%c ",i);     } } OUTPUT This program help you to print all number from 0 to 9 ,and A to Z in capital letter as well as in small later. And you also get knowledge about ASCII Value. If you like this program then you can share it and for any issues you can direct contact with me from  Home Page . For regular updates you can also follow my site. Visit Homepage

Program to find the HCF of two number in C-language

#include<stdio.h> int main() {     int a,b,i,hcf,min;     printf("Enter first number\n");     scanf("%d",&a);     printf("Enter second number\n");     scanf("%d",&b);     min=a<b?a:b;     for(i=1;i<=min;i++)     {         if(a%i==0&&b%i==0)         {             hcf=i;         }     }     printf("HCF of %d and %dis=%d",a,b,hcf); } OUTPUT Enter first number 55 Enter second number 15 HCF of 30 and 9 is=5

LCM of two number in C-language

                               Method-1 #include<stdio.h> int main() {     int a,b,i,lcm,max;     printf("Enter first number\n");     scanf("%d",&a);     printf("Enter second number\n");     scanf("%d",&b);     max=a>b?a:b;     lcm=max;     for(i=1;i<=max;i++)     {         if(max%a==0&&max%b==0)         {             lcm=max;             break;         }         max=lcm+max;     }     printf("LCM of %d and %d is=%d",a,b,lcm); }                           Method-2 #include<stdio.h> int main() { int a,b,i; printf("Enter first number\n"); scanf("%d",&a); printf("Enter second number\n"); scanf("%d",&b);  for(i=1;;i=i+1)  {   if(i%a==0&&i%b==0)   {     printf("LCM of %d and %d is=%d",a,b,i);    break; }  } } OUTPUT Enter first number 30 Enter second number 9 LCM of 30 and 9 is=90 Visit

Program to find power of any number using for loop in C-language

#include<stdio.h> int main() {  int n,i,c=1,p;     printf("Enter thenumber\n");     scanf("%d",&n);     printf("Enter the power\n");     scanf("%d",&p);  for(i=1;i<=p;i++)  {       c=c*n;   }     printf("Power of %d^%d=%d",n,p,c); } OUTPUT Enter the number 6 Enter the power 2 Power of 6^2=36 Visit Homepage

Program to print prime numbers between 1 and n in C-language

#include<stdio.h> int main() {  int n,i,j,c=0;  printf("Enter any number\n");  scanf("%d",&n);     printf("Prime number between 1 and %d is\n1",n);  for(i=1;i<=n;i++)  {         c=0;         for(j=1;j<=i;j++)         {             if(i%j==0)             {                 c++;             }         }         if(c==2)         {             printf(" %d",i);         }  } } OUTPUT Enter any number 10 Prime number between 1 and 10 is 1 2 3 5 7

Program to cheque enter number is prime or not in C-language

#include<stdio.h> int main() {  int n,i,c=0;  printf("Enter any number\n");  scanf("%d",&n);  for(i=1;i<=n;i++)  {                   if(n%i==0)             {                 c++;             } }         if(c==2)         {             printf("%d is prime",n);         }     else     {         printf("%d is nt prime",n);     } } OUTPUT Enter any number 19 19 is prime Visit Homepage

Program to print sum of Fabonacci series and series in C-language

#include<stdio.h> int main() {  int n,a,b=1,c=0,s=0;  printf("Enter any number of term\n");  scanf("%d",&n);  printf ("Fabonacci series is\n");  for(int i=1;i<=n;i++)  {   s=s+c;   printf("%d \,",c);   a=b;   b=c;   c=a+b;  }     printf("\nSum of Fabonacci series=%d",s); } OUTPUT Enter any number of term 5 Fabonacci series is 0, 1, 1, 2, 3, Sum of Fabonacci series=7

Program to print Fabonacci series to any term in C-language

#include<stdio.h> int main() {  int n,a,b=1,c=0;  printf("Enter any number of term\n");  scanf("%d",&n);  printf ("Fabonacci series is");  for(int i=1;i<=n;i++)  {   printf("%d\,",c);   a=b;   b=c;   c=a+b;  } } OUTPUT Enter any number of term 5 Fabonacci series is 0 ,1 ,1 ,2 ,3,

Program to find factorial of any number in C-language

#include<stdio.h> int main() {     int x,f=1,i;     printf("Enter the number\n");     scanf("%d",&x);     for(i=1;i<=x;i++)     {         f=f*i;     }     printf("Factorial of %d is=%d",x,f); } OUTPUT Enter the number 5 Factorial of 5 is=120

Program to find factor of any number in C-language

#include<stdio.h> int main() { int n,f=1; printf("Enter any number\n"); scanf("%d",&n); printf("Factor of %d is\n",n); for(int i=1;i<=n;i++) { if(n%i==0) printf("%d ",i); } } OUTPUT Enter any number 10 Factor of 10 is 1 2  5 10

Program to print a to z in C-language

                                Method-1 #include<stdio.h> int main() {     char i;     printf("a to z is\n");     for(i=97;i<=122;i++)     {         printf("%c ",i);     } }                             Method-2 #include<stdio.h> int main() {     char i;     printf("a to z is\n");     for(i='a';i<='z';i++)     {         printf("%c ",i);     } } OUTPUT a to z is a b c d e f g h i j k l m n o p q r s t u v w x y z 

Program to print A to Z in C-language

                                    Method-1 #include<stdio.h> int main() {     char i;     printf("A to Z is\n");     for(i=65;i<=90;i++)     {         printf("%c ",i);     } }                                 Method-2 #include<stdio.h> int main() {     char i;     printf("A to Z is\n");     for(i='A';i<='Z';i++)     {         printf("%c ",i);     } } OUTPUT A to Z is  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 

Program to print table of any number in C-language

#include<stdio.h> int main() {     int i,n;     printf("Enter the number\n");     scanf("%d",&n);     for(i=1;i<=10;i++)     {         printf("%d*%d=%d\n",n,i,n*i);     } } OUTPUT Enter the number 5 5*1=5 5*2=10 5*3=15 5*4=20 5*5=25 5*6=30 5*7=35 5*8=40 5*9=45 5*10=50

Program to print all odd number from 1 to n in C-language

#include<stdio.h> int main() {     int i,n,sum=0;     printf("Enter the last number\n");     scanf("%d",&n);     printf("All odd number from 1to %d is\n",n);     for(i=1;i<=n;i+=2)     {         printf("%d ",i);     } } OUTPUT Enter the last number 9 All odd number from 1 to 9 is 1 3 5 7 9

Program to print all even number from 1 to n in C-language

#include<stdio.h> int main() {     int i,n,sum=0;     printf("Enter the last number\n");     scanf("%d",&n);     printf("All even number from 1to %d is\n",n);     for(i=2;i<=n;i+=2)     {         printf("%d ",i);     } } OUTPUT Enter the last number 9 All even number from 1 to 9 is 2 4 6 8 

Program to print sum of natural number from 1 to n,and natural number in C-language

#include<stdio.h> int main() {     int i,n,sum=0;     printf("Enter the last natural number\n");     scanf("%d",&n);     printf("All natural number from 1to %d is\n",n);     for(i=1;i<=n;i++)     {         printf("%d ",i);         sum=sum+i;     }     printf("\nSum of natural number=%d",sum); } OUTPUT Enter the last natural number 9 All natural number from 1 to 9 is 1 2 3 4 5 6 7 8 9  Sum of natural number=45

Program to print reverse natural number from any number to n in C-language

#include<stdio.h> int main() {     int i,n;     printf("Enter the last natural number\n");     scanf("%d",&n);     printf("All reverse natural number from %d to 1 is\n",n);     for(i=n;i>=1;i--)     {         printf("%d ",i);     } } OUTPUT Enter the last natural number 8 All reverse natural number from 8 to 1 is 8 7 6 5 4 3 2 1 Visit Homepage

Program to print natural number from 1 to any number in C-language

#include<stdio.h> int main() {     int i,n;     printf("Enter the last natural number\n");     scanf("%d",&n);     printf("All natural number from 1to %d is\n",n);     for(i=1;i<=n;i++)     {         printf("%d ",i);     } } OUTPUT Enter the last natural number 9 All natural number from 1to 9 is  1 2 3 4 5 6 7 8 9

Program to find greater number among three numbers using ternary operator in C-language

#include<stdio.h> int main() {     int a,b,c,x,y;     printf("Enter first number\n");     scanf("%d",&a);     printf("Enter second number\n");     scanf("%d",&b);     printf("Enter third number\n");     scanf("%d",&c);    x=a>b?a:b;    y=x>c?x:c;     printf("Greatest number is=%d",y); } OUTPUT Enter first number 8 Enter second number 56 Enter third number 89 Greatest number is=89

Program to find greatest number between two number using ternary operator in C-language

                              Method-1         #include<stdio.h> int main() {     int a,b,m;     printf("Enter first number\n");     scanf("%d",&a);     printf("Enter second number\n");     scanf("%d",&b);     m=a>b?a:b;     printf("Greatest number=%d",m); }                         Method-2           #include<stdio.h> int main() {     int a,b;     printf("Enter first number\n");     scanf("%d",&a);     printf("Enter second number\n");     scanf("%d",&b);     a>b?printf("Greatest is=%d",a):printf("Greatest is=%d",b); } OUTPUT Enter first number 80 Enter second number 67 Greatest is=80

Program to cheque enter four digit number is Armstrong or not in C-language

#include<stdio.h> #include<math.h> int main() {     int a,b,c,d,m,x,arm;     printf("Enter four digit number\n");     scanf("%d",&x);     m=x;     a=x%10;     x=x/10;     b=x%10;     x=x/10;     c=x%10;     x=x/10;     d=x%10;     x=x/10;     arm=pow(a,4)+pow(b,4)+pow(c,4)+pow(d,4);     if(arm==m)     {         printf("Enter number is Armstrong");     }     else     {         printf("Enter number is not Armstrong");     } } OUTPUT Enter four digit number 1634 Enter number is Armstrong

Program to cheque enter three digit number is Armstrong or not in C-language

#include<stdio.h> #include<math.h> int main() {     int a,b,c,m,x,arm;     printf("Enter three digit number\n");     scanf("%d",&x);     m=x;     a=x%10;     x=x/10;     b=x%10;     x=x/10;     c=x%10;     x=x/10;     arm=pow(a,3)+pow(b,3)+pow(c,3);     if(arm==m)     {         printf("Enter number is Armstrong");     }      else { printf("Enter number is not Armstrong");    } OUTPUT Enter three digit number 153 Enter number is Armstrong

Program to link webpage/website using C-language

Image
Program to link webpage/website using C-language  #include<stdlib.h> int main() { system(" explorer http://www.codingsir.blogspot.com"); } OUTPUT sh: explorer: This program give you a different experience . Using this program you can link any website only you have write in give format. system("explorer http://website name"); If you like this program then you can share it and for any issues you can direct contact with me from  Home Page . For regular updates you can also follow my site. Visit Homepage

Program to cheque four digits number is palindrome or not in C-language

#include<stdio.h> int main() {     int a,b,c,d,x,m,rev;     printf("Enter four digit numbers\n");     scanf("%d",&x);     m=x;     a=x%10;     x=x/10;     b=x%10;     x=x/10;     c=x%10;     x=x/10;     d=x%10;     x=x/10;     rev=a*1000+b*100+c*10+d;     if(rev==m)     {         printf("Enter Number is Palindrome");     }     else     {         printf("Enter number is not Palindrome");     } } OUTPUT Enter four digit numbers 1771 Enter Number is Palindrome

Program to cheque enter three digits number are palindrome or not in C-language

#include<stdio.h> int main() {     int a,b,c,x,m,rev;     printf("Enter three digits numbers\n");     scanf("%d",&x);     m=x;     a=x%10;     x=x/10;     b=x%10;     x=x/10;     c=x%10;     x=x/10;     rev=a*100+b*10+c;     if(rev==m)     {         printf("Enter Number is Palindrome");     }     else     {         printf("Enter number is not Palindrome");     } } OUTPUT Enter three digits numbers 141 Enter Number is Palindrome

Popular posts

Creative pattern of butterfly in C-language

Program to show present time and date in C-language

Introduction of C-language.

Program to cheque enter number is a perfect number or not using if else in C-language

Program to cheque four digits number is palindrome or not in C-language

Program to print the cube of a number in c-language

Simple Hello world program in c- language