Program to perform palindrome in a function with reverse as a seperate function.

#include<stdio.h>
int rev(int);
void pali(int);
void main()
{
int a;
printf("\n enter a number");
scanf("%d",&a);
pali(a);
}
void pali(int x)
{
int dup;
dup=x;
x=rev(x);
if(dup==x)
printf("\n number is palindrome");
else
printf("\n number isn't palindrome");
}
int rev(int y)
{
int rem,rev;
rem=0;rev=0;
while(y>0)
{
rem=y%10;
rev=rev*10+rem;
y=y/10;
}
return(rev);
}

Program to change string to upper case using function

#include<stdio.h>
#include<string.h>
#include<ctype.h>
void upper(char a[]);
void main()
{
char a[80];
printf("\n enter a string");
scanf("%[^\n]",a);
upper(a);
}
void upper(char a[])
{
int len,i;
len=strlen(a);
for(i=0;i<len;i++)
{
a[i]=toupper(a[i]);
}
printf("\n%s",a);
}

Program to count number of vowels,sentences and spaces in a paragraph

#include<stdio.h>
#include<string.h>
void main()
{
char line[80];
char vow[6]="aeiou";
int i,j,countv,countf,countsp,len;
countv=0;countf=0;countsp=0;
printf("\n enter the string");
scanf("%[^\n]",line);
len=strlen(line);
for(i=0;i<len;i++)
{
for(j=0;j<6;j++)
{
if(line[i]==vow[j])
countv++;
}
if(line[i]==' ')
countsp++;
else if(line[i]=='.')
countf++;
}
printf("\n the number of vowels is:%d\n the number of spaces is %d\n the number of strings is %d",countv,countsp,countf);
}

C program to perform bubble sort using function

#include<stdio.h>
#include<stdlib.h>
void bubblesort(int a[],int size);
void main()
{
int a[50],n,i;
printf("\n enter the size of the array");
scanf("%d",&n);
if(n>50)
{
printf("\n error");
exit(0);
}
printf("\n enter the array\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
bubblesort(a,n);
printf("\n the sorted array is\n");
for(i=0;i<n;i++)
printf("%d\t",a[i]);
}
void bubblesort(int a[],int size)
{
int temp,i,j;
for(i=0;i<size;i++)
{
for(j=0;j<size-1;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
}