Tuesday 17 September 2019

ONLINE EXAMINATION[c programming language]

ONLINE EXAMINATION

Program:

#include<stdio.h>
#include<conio.h>
void prn();
main()
{
int i,m=0;
long ht;
char name[20];
char f[10];
char ch[50]="STATE TRUE OR FALSE. EACH CARRIES ONE MARK.";
clrscr();
prn();
gotoxy(5,4);
printf("STUDENT NAME    : ");
scanf("%s",name);
gotoxy(5,6);
printf("HALLTICKET NUMBER : ");
scanf("%ld",&ht);
clrscr();
prn();
gotoxy(2,5);
printf("%s",ch);
gotoxy(2,6);
for(i=0;i<strlen(ch);i++)
printf("-");
printf("\n\n");
printf("1. Structure is not a data type :");
scanf("%s",&f[0]);
if(f[0]==101  ||  f[0]==70)
m++;
printf("\n");
printf(2. C program is a collection of functions:");
scanf("%s",&f[1]);
if(f[1]==116 || f[1]==80)
m++;
printf("\n");
printf("3. In an array we can accept more than one value of same type :");
scanf("%s",&f[2]);
if(f[2]==116  || f[2]==84)
m++;
printf("\n");
printf("4. String is a character array :");
scanf("%s",&f[3]);
if(f[3]==116 || f[3]==84)
m++;
printf("\n");
printf("5. Any function cannot be called from any other function :");
scanf("%s",&f[4]);
if(f[4]==102 || f[4]==70)
m++;
printf("\n");
printf("6.fflush() is a macro: ");
scanf("%s",&f[5]);
if(f[5]==102 || f[5]==70)
m++;
printf("\n");
printf("7. When the file is opened in 'a+' mode modification is possible: ");
scanf("%s",&f[6]);
if(f[6]==102 || f[6]==84)
m++;
printf("\n");
printf(8. Break is a reverse word: ");
scanf("%s",&f[7]);
if(f[7]==116 || f[7]==84)
m++;
printf("\n");
printf("9. STRCHR finds the first occurrence of a given character in a string: ");
scanf("%s",&f[8]);
if(f[8]==116 || f[8]==84)
m++;
printf("\n");
printf("10. FILE STRUCTURE CONTAINS INFORMATION ABOUT THE FILE BEING USED: ");
scanf("%s",&f[9]);
if(f[9]==116 || f[9]==84)
m++;
clrscr();
prn();
printf("\n\n");
printf("STUDENT NAME               :%s",name);
printf("\n HALL TICKET NUMBER      :%ld",ht);
printf("\nTOTAL MARKS              :%d",m);
getch();
}
void prn()
{
gotoxy(25,2);
printf("C EXAMINATION");
gotoxy(25,3);
printf("_____________");
}

Output:
                                              C EXAMINATION
STUDENT NAME                : Avinash
HALL TICKET NUMBER   : 9192001

                                              C EXAMINATION
1.Structure is not a data type:f
2. C program is a collection of functions:t
3. In an array we can accept more than one value of same type :t
4. String is a character array :t
5. Any function cannot be called from any other function :f
6.fflush() is a macro:f
7. When the file is opened in 'a+' mode modification is possible:f
8. Break is a reverse word:t
9. STRCHR finds the first occurrence of a given character in a string: t
10. FILE STRUCTURE CONTAINS INFORMATION ABOUT THE FILE BEING USED:t

                                              C EXAMINATION
STUDENT NAME                  : Avinash
HALL TICKET NUMBER     :9192001
TOTAK MARKS                     :10


                                  Best Budget Laptop For Web Developers 2019

Best Budget Laptop For Programmershttps://amzn.to/2LOr3w9
Mi Fitness Band (On Offer) -   https://amzn.to/2AxC7IF
Honor Band 4(Fitness Band)https://amzn.to/2NkLjZz

Sunday 24 February 2019

Generating Numbers in the Combination of given Numbers[c programming examples with output]

Generating Numbers in the Combination of given Numbers

Program:

#include<stdio.h>
#inclue<conio.h>
main()
{
        int t,r,range,i,j,s,d;
        int a[5],b[5];
        long n;
        clrscr();
        printf("Enter no. of numbers for combination : ");
        scanf("%d",&d);
        printf("\nENter numbers for combination : ");
        for(i=0;i<d;i++)
           scanf("%d",&a[i]);
           printf("\nEnter the range : ");
           scanf("%d",&range);
           for(i=1;i<=range;i++)
          {
               n=i;s=0;t=0;
               while(n>0)
               {
                   j=0;
                   r=n%10;
                   t++;
                   while(j<d)
                   {
                       if(r==a[j])
                       s++;
                       j++;
          }
          n=n/10;
  }
         if(s==t)
             printf("%d\t",i);
         }
  getch();
}

OutPut:

Enter no. of numbers for combination:2
Enter numbers for combination:4
8
Enter the range:500
4    8    44    48    84    88
444  448  484   488

                                        Best Budget Laptop For Web Developers 2019
Best Budget Laptop For Programmershttps://amzn.to/2LOr3w9

Friday 8 February 2019

Program To Find The Sum Of The Given n Integers Using An Array[c programming examples with output]

Write A Program To Find The Sum Of The Given n Integers Using An Array

/*Program To Find Sum Of n Integers*/
#include<stdio.h>
#include<conio.h>
main()
{
    int x[50],n,i,sum;
    clrscr();
    printf("\n How many integers??");
    scanf("%d",&n);
        /*loop to read N integers*/
         f or(i=0;i<n;i++)
   {
       printf("\n Enter the %dth value: ",i+1);
       scanf("%d",&x[i]);
   }
   sum=0;
      /*loop to find sum of all integers*/
         for(i=0;i<n;i++)
       sum=sum=sum+x[i];
       printf("\nSum of all integers=%d",sum);
       getch();
}

OutPut:
How many integers??5
Enter the 1th value: 36
Enter the 2th value: 45
Enter the 3th value: 52
Enter the 4th value: 40
Enter the 5th value: 61
Sum of all integers=234

                                                   
                                         Best Budget Laptop For Web Developers 2019
Best Budget For Programmers: https://amzn.to/32GkrqC

Friday 11 January 2019

Pattern 10 using c[c programming examples with output]

C programming examples with output

Pattern
Program

#include<stdio.h>
#include<conio.h>
void main()
{
     int i,j;
     clrscr();
     for(i=1;i<=5;i++)
     {
         for(j=1;j<=i;j++)
         {
              printf("*");
         }
              printf("\n");
     }
     getch();
}

Output

*
**
***
****
*****

Best Budget Laptop For Web Developers 2019

Best Budget Laptop For Programmers: https://amzn.to/32GkrqC

Pattern 9 using c[c programming examples with output]

C programming examples with output

Pattern


Program
#include<stdio.h>
#include<conio.h>
void main()
{
    char i'j;
    clrscr();
    for(i='E';i>='A';i--)
    {
        for(j='E';j>="A';j--)
        {
            printf("%c",j);
        }
            printf("\n");
    }
    getch();
}

Best Budget Laptop For Web Developers 2019
Best Laptop For Programmers: https://amzn.to/32GkrqC

Pattern 8 using c[c programming examples with output]

C programming examples with output

Pattern
Program
#include<stdio.h>
#include<conio.h>
void main()
{
     char i,j;
     clrscr();
     for(i='E';i>='A';i--)
     {
         for(j='E';j>='A';j--)
        {
            printf("%c",i);
         }
            printf("\n");
     }
     getch();
}

Output:
EEEEE
DDDDD
CCCCC
BBBBB
AAAAA

Pattern 7 using c[c programming examples with output]

C programming examples with output

Pattern

Pattern
Program

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


Pattern 6 using c[c programming examples with output]

C programming examples with output

Pattern


Program

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


Pattern 5 using c[c programming examples with output]

C programming examples with output

Pattern
Program

#include<stdio.h>
#include<conio.h>
void main()
{
     char i,j;
     clrscr();
     for(i='A';i<='E';i++)
     {
         for(j='A';j<='E';j++)
         {
              printf("%c",j);
         }
     printf("\n);
      }
     getch();
}

Output

A B C D E
A B C D E
A B C D E
A B C D E
A B C D E

Pattern 4 using c[c programming examples with output]

C programming examples with output

Pattern
Program
#include<stdio.h>
#include<conio.h>
void main()
{
char i,j;
clrscr();
for(i='A';i<='E';i++)
{
for(j='A';j<='E';j++)
{
printf("%c",i);
}
printf("\n");
}
getch();
}

Output:

AAAAA
BBBBB
CCCCC
DDDDD
EEEEE

Pattern 3 using c[c programming examples with output]

C programming examples with output

Pattern
                                                 

Program

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

Output:

12345
12345
12345
12345
12345

Pattern 2 using c[c programming examples with output]

C programming examples with output


Pattern
                                                   

Program

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

Output:

11111
22222
33333
44444
55555

Pattern 1 using c[c programming examples with output]

C programming examples with output

Pattern
Program

#include<stdio.h>
#include<conio.h>
void main()
{
      int i,j;
      clrscr();
      for(i=1;i<=5;i++)
      {
          for(j=1;j<=5;j++)
         {
            printf("*");
         }
            printf("\n");
      }
       getch();
}

Output:

*****
*****
*****
*****
*****

Monday 7 January 2019

Condensing A Number into Single Digit with c programming[c programming examples with output]

C programming examples with output

Condensing A Number into Single Digit
Program

#include<stdio.h>
#include<conio.h>
main()
{
      int r,i,j,s;
      int a[10];
      long n;
      clrscr();
      printf("Enter any number : ");
      scanf("%ld",&n);
      do
      {
             s=0;i=0;
             while(n>0)
            {
                   r=n%10;
                   a[i]=r;
                   s=s+r;
                   i++;
                   n=n/10;
            }
            --i;
     if(i!=0)
             n=s;
             if(i==0 || i==1)
             {
                   printf("single digit= %d",n);
                   break;
             }
}while(i>0);
getch();
}

Output:
Enter any number:9876543221
((9+8+7+6+5+4+3+2+1)=(45)=(4+5)=9)
single digit=9
Enter any number:32190
single digit=6
Enter any number:1092387456
single digit=9

Best Budget Laptop For Web Developers 2019

Sunday 6 January 2019

Program For Shutdown Computer[c programming examples with output]

C programming examples with output

Shutdown Computer
Program

#include<stdio.h>
#include<stdlib.h>
main()
{
      char ch;
      printf("Do you want to shutdown your computer now(y/n)\n");
      scanf("%c",&ch);
      if(ch=='y' || ch=='Y')
      system("C:\\Windows\\system32\\shutdown/s");
      return 0;
}

Pyramid Of Numbers With C[c programming examples with output]

C programming examples with output

Pyramid Of Numbers
Program

#include<stdio.h>
#include<conio.h>
main()
{
     int rows,t,i,j,k,s;
     clrscr();
     printf("Enter no.of rows to print : ");
     scanf("%d",&rows);
     t=1;
    for(i=1;i<=rows;i++)
    {
        for(j=0;j<(rows-i);j++)
        printf(" ");
        s=(2*i)-1;
            for(k=0;k<s;k++)
       {
            if(t<10)
            printf("%d ",t);
            else
            printf("%d ",t);
            t++;
       }
           printf("\n\n");
    }
    getch();
}

Output:
Enter no, of rows to print:5
                1
             2  3  4
           5 6  7  8  9
       10 11 12 13 14 15 16
    17 18 19 20 21 22 23 24 25

Print Date with c[c programming examples with output]

C programming examples with output

Print Date
Program

#include<stdio.h>
#include<conio.h>
#include<dos.h>
int main()
{
       struct date d;
       getdate(&d);
       printf("Current system date is %d%d/%d,d.da_day,d.da_mon,da_year);
       getch();
       return 0;
}

Local Variables[c programming examples with output]

C programming examples with output

Local Variables
Program

#include<stdio.h>
#include<conio.h>
void fun1();
void fun2();
main()
{
      int t;
      clrscr();
      t=1000;
      fun2();
      printf("\n");
      printf("%d",t);
      getch();
}
     void fun1()
{
     int t;
     t=10;
     printf("%d",t);
}
void fun2()
{
    int t;
    t=100;
    fun1();
    printf("\n");
    printf("%d",t);
}

Output:
10
100
1000

Length of string using Pointer in c[c programming examples with output]

C programming examples with output

Length of string using Pointer
Program

#include<stdio.h>
int string_In(char*);
void main()
{
      char str[20];
      int length;
      printf("\nEnter any string: ");
      gets(str);
      length=string_In(str);
      printf("The length of the given string %s is: %d",str,length);
}
      int string_In(char*p)
{
      int count=0;
      while(*p!='\0'){
      count++;
      p++;
}
return count;
}

Output:
Enter any string: programming
The length of the given string programming is: 11

Addition using pointer in c[c programming examples with output]

C programming examples with output

Addition using pointer
Program

#include<stdio.h>
int main()
{
      int first,second,*p,*q,sum;
      printf("Enter two integers to add\n");
      scanf("%d%d",&first,&second);
      p=&first;
      q=&second;
      sum=*p+*q;
      printf("Sum of entered numbers=%d\n",sum);
      return 0;
}

Output:
Enter two integers to add
4
6
Sum of entered numbers=10

Asterisks Graph with c[c programming examples with output]

C programming examples with output

Asterisks Graph
Program

#include<stdio.h>
#include<conio.h>
main()
{
      int i,j,rows;
      clrscr();
      printf("Enter number of rows  :");
      scanf("%d",&rows);
      for(i=1;i<=rows;i++)
      {
          for(j=1;j<=1;j++)
         {
            printf("* ");
         }
      printf("\n");
      }
getch();
}

Output:
Enter number of rows:7
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *

Check Leap Year Or Not in c[c programming examples with output]

C programming examples with output

To Check Leap Year Or Not
Program

#include<stdio.h>
#include<conio.h>
main()
{
     int year,i;
     clrscr();
     printf("Enter year : ");
     scanf("%d",&year);
     if(year%4==0)
         printf("%d is a leap year.",year);
     else
         printf("%d is not a leap year.",year);
     getch();
}

Output:
Enter year:2020
2020 is a leap year.
Enter year:2017
2017 is not a leap year.

Best Budget Laptop For Web Developers 2019

Copy String with c program[c programming examples with output]

C programming examples with output

Copy String
Program

#include<stdio.h>
#include<string.h>
main()
{
      char source[]="C programming";
      char destination[50];
      strcpy(destination,source);
      printf("Source string: %s\n",source);
      printf("Destination string: %s\n",destination);
      return 0;
}

Output:
Source string: C programming
Destination string: C programming

Checking if given number is binary number or not in c[c programming examples with output]

C programming examples with output

Checking if given number is binary number or not
Program

#include<stdo.h>
#include<conio.h>
main()
{
     int r,c;
     long n,t;
     clrscr();
     printf("Enter any number : ");
     scanf("%ld",&n);
     t=n;
     c=r=0;
     while(n>0)
     {
         if(n%10==0 || n%10==1)
         c++;
         r++;
         n=n/10;
     }
        if(c==r)
            printf("\n%ld is a binary number",t);
       else
            printf("\n%ld is not a binary number",t);
       getch();
}

Output:
Enter any number:12345
12345 is not a binary number
Enter any number:10000001
10000001 is a binary number

Celsius To Fahrenheit with c program[c programming examples with output]

C programming examples with output

Celsius To Fahrenheit
Program

#include<stdio.h>
#include<conio.h>
void main()
{
     float c,f;
     clrscr();
     printf("Enter temperature in centigrade: ")
     scanf("%f",&c);
     f=(1.8*c)+32;
     printf("Temperature in Fahrenheit= %f",f);
     getch();
}

Output:
Enter temp in centigrade:100
Temperature in Fahrenheit=212

Saturday 5 January 2019

Program to print anything without using semicolon ';'[c programming examples with output]

C programming examples with output

Program to print anything without using semicolon ';'
Program

#include<stdio.h>
#include<conio.h>
void main()
{
      while(!printf("Welcome to MoTech360"))
{

}
}

Output:
Welcome to MoTech360



Prime number below a range[c programming examples with output]

C programming examples with output

Prime number below a range
Program

#include<stdio.h>
#include<conio.h>
main()
{
      int a,b,c=0,r;
      clrscr();
      printf("Enter range  :");
      scanf("%d",&r);
      a=1;
      while(a<=r)
      {
         b=1;c=0;
      while(b<=a)
      {
         if(a%b==0)
         c=c+1;
         b++;
      }
         if(c==2)
         printf("\n%d is a prime number",a);
         a++;
      }
      getch():
}

Output
Enter range:20
2 is a prime number
3 is a prime number
5 is a prime number
7 is a prime number
11 is a prime number
13 is a prime number
17 is a prime number
19  is a prime number

Find Static Variables[c programming examples with output]

C programming examples with output

Find Static Variables
Program

#include<stdio.h>
#include<conio.h>
main()
{
     int c;
     clrscr();
     for(c=1;c<=3;c++)
     stat();
     getch();
     }
     stat()
     {
     static int sv=0;
     sv=sv+1;
     printf("%d",sv);
}

Output
1
2
3

Reverse of a number[c programming examples with output]

C programming examples with output

Reverse of a number
Program

#include<stdio.h>
#include<conio.h>
main()
{
      int n,rev=0;
      printf("Enter a number to rev:\n");
      scanf("%d",&n);
      while(n!=0)
      {
         rev=rev*10;
         rev=rev+n%10;
         n=n/10;
      }
      printf("Reverse of entered number is=%d\n",rev);
      getch();
}

Output:
Enter a number to reverse:
1234
Reverse of entered number is=4321

Find factorial of a number[c programming examples with output]

C programming examples with output

Find factorial of a number
Program

#include<stdio.h>
#include<conio.h>
main()
{
      int a,b,c;
      clrscr();
      printf("Enter any number  :");
      scanf("%d",&a);
      c=a;
      b=1;
      while(c>0)
     {
          b=b*c;
          c-;
     }
     printf("Factorial of %d  :  %d",a,b);
     getch();
}

Output
Enter any number:6
Factorial of 6:720

Friday 4 January 2019

Electricity Bill[c programming examples with output]

C programming examples with output

Electricity Bill
Program

#include<stdio.h>
#include<conio.h>
main()
{
        int cno,pmr,cmr,cu;
        float total;
        char sec;
        char cname[10];
        clrscr();
        printf("Enter the sector                :");
        scanf("%c",&sec);
        printf("Enter customer name        :");
        scanf("%s",cname);
        printf("Enter customer number     :");
        scanf("%d",&cno);
        printf("Enter the previous units     :");
        scanf("%d",&pmr);
        printf("Enter the current units       :");
        scanf("%d",&cmr);
        cu=cmr-pmr;
        if(sec=='a')
          {
            if(cu>300)
            total=cu*2.00;
                 if(cu>200 && cu<=300)
                 total=cu*1.50;
                       if(cu>100 && cu<=200)
                       total=cu*1.00;
                             if(cu<=100)
                             total=cu*0.50;
          }
          if(sec=='i')
          {
              if(cu>300)
              total=cu*4.00;
                     if(cu>200 && cu<=300)
                     total=cu*3.00;
                             if(cu>100 && cu<=200)
                             total=cu*2.00;
                                      if(cu<=100)
                                      total=cu*1.00;
}
if(sec=='d')
   {
          if(cu>300)
          total=cu*2.00;
                  if(cu>200 && cu<=300)
                  total=cu*1.50;
                         if(cu>100 && cu<=200)
                         total=cu*1.00;
                                if(cu<=100)
                                total=cu*0.50;
  }
           printf("\nCustomer name     :  %s",cname);
           printf('\nCustomer number   :  %d",cno);
           prinf("\nPrevious units         :  %d",pmr);
           printf('\nCurrent units           :  %d",cmr);
           printf("\nCategory                 :  %c",sec);
           printf("\nConsumed units      :  %d",cu);
           printf("\nElectric bill             :  %f",total);
           getch();
}

Output
Enter the sector                 :i
Enter customer name        :Ram
Enter customer number    :1234
Enter the privious units     :567
Enter the current units       :890
Customer name                 :Ram
Customer number             :1234
Previous units                   :567
Current units                     :890
Category                           :i
Consumed units                :323

Thursday 3 January 2019

Floyd's Triangle[c programming examples with output]

C programming examples with output


Floyd's Triangle
Program:

#include<stdio.h>
#iniclude<conio.h>
main()
{
      int a,b,c,rows;
      clrscr();
      printf("Enter number of rows: ");
      scanf("%d",&rows);
      c=1;
      for(a=0;a<rows;a++)
      {
             for(b=0;b<=a;b++)
            {
                 if(c<10)
                      printf("%d   "c);
                 else
                      printf("%d   ",c);
              c++;
        }
        printf("\n");
      }
      getch();
}

Output
Enter numbers of rows:5

1
2   3
4   5   6
7   8   9   10
11  12  13  14  15


Check others programming by click here:
Factorial of a number:
Find sum of digits of a number:
Find vowel or not:
Palindrome Number:

Swapping of two integers[c programming examples with output]

C programming examples with output

Swapping of two integers
Program

#incluede<stdio.h>
#include<conio.h>
main()
{
      int a,b;
      clrscr();
      printf("Enter two numbers : ");
      scanf("%d%d",&a,&b);
      printf("\nValue of a :  %d",a);
      printf("\nValue of b :  %d",b);
      a=a+b;
      b=a-b;
      a=a-b;
      printf("\nVAlue of a :  %d",a);
      printf("\nValue of b :  %d",b);
      getch();
}

Output
Enter two numbers:34
56
Value of a:34
Value of b:56
Value of a:56
Value of b:34

Check others programming by click here:
Factorial of a number:
Find sum of digits of a number:
Find vowel or not:
Palindrome Number:

Tuesday 1 January 2019

Find result of a student[c programming examples with output]

C programming examples with output

Find result of a student

Program

#include<stdio.h>
#include<conio.h>
main()
{
        int m1,m2,m3,m4,m5,m6,total;
        char result,grade,name[15];
        float avg;
        clrscr();
        printf("Enter student name: ");
        scanf("%s",name);
        printf("\nEnter 6 marks: ");
        scanf("%d%d%d%d%d%d",&m1,&m2,&m3,&m4,&m5,&m6);
        total=m1+m2+m3+m4+m5+m6;
        avg=total/6;
        if(avg>40)
        {
              result= 'P';
        if(avg>75)
             grade='A';
        else if(avg>60 && avg<=75)
             grade='B';
        else if(avg>50 && avg<=60)
             grade='C';
        else
             grade='D';
        }
        else
            result='f';

        printf("\nStudent name  : %s",name);
        printf("\nMarks         : ");
        printf("\n%d\t%d\t%d\t%d\t%d\t%dt",m1,m2,m3,m4,m5,m6);
        printf("\nAverage marks : %f",avg);
        if(result=='p')
            printf("\nResult        : Pass");
        else
            printf("\nResult        : fail");
            printf("\nGrade         : %c",grade);
        getch();
}

Output

Enter student name: Prem
Marks             :
65  69  73  80  90  97
Average result    : 79.000000
Result            : Pass
Grade             : A


Check others programming by click here:
Factorial of a number:
Find sum of digits of a number:
Find vowel or not:
Palindrome Number:

Factorial of a number[c programming examples with output]

C programming examples with output

Factorial of a number

Program
#include<stdio.h>
#include<conio.h>
main()
{
       int a,b,c;
       clrscr();
       printf("Enter any number: ");
       scanf("%d",&a);
       c=a;
       b=1;
       while(c>0)
       {
       b=b*c;
       c-;
       }
       printf("Factorial of %d is:  %d",a,b);
       getch();
}

Output

Enter any number:6
Factorial of 6 is:720


Find sum of digits of a number[c programming examples with output]

C programming examples with output

Find sum of digits of a number

Program

#include<stdio.h>
#include<conio.h>
main()
{
       int a,b;
       long n;
       clrscr();
       printf("Enter any numbr: ");
       scanf("%ld",&n);
       b=0;
       while(n>0)
       {
             a=n%10;
             b=b+a;
             n=n/10;
        }
        printf("The sum of digits is %d",b);
        getch();
}

Output

Enter any number: 45632
The sum of digits is 20

Find vowel or not[c programming examples with output]


C programming examples with output:

Find vowel or not

Program
#include<stdio.h>
#include<conio.h>
main()
{
       char ch;
       clrscr();.
       printf("Enter any charecter: ");
       scanf("%c",&ch);
       switch(ch)
       {
          case 'A':
                  printf("%c is a vowel",ch);
                  break;
          case 'E':
                  printf("%c is a vowel",ch);
                  break;
          case 'I':
                  printf("%c is a vowel",ch);
                  break;
          case 'O':
                  prinntf)'%c is a vowel",ch);
                  break;
          case 'U':
                  printf("%c is a vowel",ch);
                  break;
                  default:
                  printf("%c is not a vowel",ch);
                   }
                  getch();
}

Output

Enter any character: a
a is a vowel
Enter any character: x
x is not a vowel

Find Palindrome Number[c programming examples with output]

C programming examples with output

Palindrome Number


Program

#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,d;
clrscr();
printf("Enter any number: ");
scanf("%d",&a);
b=a;
c=0;
while(n>0)
{
        d=a%10;
        c=(c*10)+d;
        a=a/10;
}
if(b==c)
          printf("%d is Palindrome Number",b);
else
          printf("%d is not Palindrome Number",b);
getch();
}

Output

Enter any number:135
135 is not Palindrome Number
Enter any number:121
121 is Palindrome NUmber