Wednesday, November 26, 2014

count character , small letter,capital letter, double letter, Vowel in a sentence

 

count character , small letter,capital letter, double letter, Vowel in a sentence

 

#include<stdio.h>
int main ()
{
    char c,ql;
    int d=0,tl=0,sl=0,cl=0,v=0,con,w=1,s=0,dl=0;
    printf("\n\tEnter The Massage: ");
    c=getchar();
    ql=c;
    while(c!='\n')
    {
        d++;
 
        if(c>='a'&&c<='z')
        {
            sl++;
        }
 
        if(c>='A'&&c<='Z')
        {
            cl++;
        }
 
        tl=sl+cl;
 
        if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='A'||c=='E'||c=='I'||c=='O'||c=='U')
        {
            v++;
        }
 
        con=tl-v;
 
        if(c==' ')
        {
            w++;
        }
 
        if(c=='.')
        {
            s++;
        }
 
        c=getchar();
 
        if(ql==c)
        {
            dl++;
        }
 
    }
    printf("\n\n\tYour message has %d character.",d);
    printf("\n\n\tYour message has %d letter.",tl);
    printf("\n\n\tYour message has %d small letter.",sl);
    printf("\n\n\tYour message has %d capital letter.",cl);
    printf("\n\n\tYour message has %d double letter.",dl);
    printf("\n\n\tYour message has %d Voule.",v);
    printf("\n\n\tYour message has %d Consonant.",con);
 
    printf("\n\n\tYour message has %d word.",w);
    printf("\n\n\tYour message has %d sentence.",s);
 
    printf("\n\n\n\tPress Any Key To EXIT!!");
    getch();
    return 0;
}

Series=40-38+36-........n

Series=40-38+36-........n

 

 

//Series=40-38+36-........n
 
#include<stdio.h>
int main(){
    int n,sum,increase,term;
    scanf("%d",&n);
    sum=0;
    increase=40;
    for(term=0;term<n;term++){
        if(term%2==0)
            sum+=increase;
        else
            sum-=increase;
        increase-=2;
    }
    printf("The summation of the series id %d\n",sum);
    return 0;
}

show capital letters in small & small in capital

 

show capital letters in small & small in capital

 

#include<stdio.h>
int main()
{
    char a[100];
    int i,c=0;
    scanf("%s",a);
   for(i=0;a[i]!='\0';i++)
   {
      if(a[i]>=65&&a[i]<=90)
      {
          a[i]=a[i]+32;
      }
      else
      {
          a[i]=a[i]-32;
      }
   }
    printf("%s",a);
    return 0;
}

separate each number from a big number

separate each number from a big number

 

#include<stdio.h>
main()
{
    int n,k;
 
    scanf("%d",&n);
    for(;n!=0;n=n/10)
    {
        k=n%10;
        printf("%d\n",k);
    }
}

Second to Hour /Min convert

Second to Hour /Min  convert

 

#include <stdio.h>
main()
{
    int x,y,hour,min,sec,total;
    printf("Total secend= ");
    scanf("%d",&total);
    hour=total/3600;
    printf("%d Hour\n",hour);
    x=total%3600;
    min=x/60;
    printf("%d Minute\n",min);
    y=total/60;
    sec=total-60*y;
    printf("%d Second\n",sec);
    return 0;
}

printf -n to n

print -n to n

 

 

 

//print -n to n
#include<stdio.h>
int main()
{
    int n,m;
    scanf("%d",&n);
    m=n*-1;
    while(m<=n){
        printf("%d\t",m);
        m++;
    }
    printf("\n");
    return 0;
}
 

Sound

 

Sound

#include<stdio.h>
main()
{
    int i;
    for(i=0;i<99;i++)
    printf("\a",i);
}

Namta

 

Namta

 

//Namta 
#include<stdio.h>
int main()
{
    int n,i,sum=1;
    printf("Enter the Number : ");
    scanf("%d",&n);
 
    for (i=1; i<=10; i++)
    {
        printf("%d*%d =",n,i);
        sum=n*i;
        printf(" %d",sum);
        printf("\n");
    }
    return 0;
}

peramid print using loop

peramid print using loop

 

 

image

#include<stdio.h>
main()
{
    int i,j,k;
    for(i=1;i<=10;i++)
    {
        for(k=1;k<=i;k++)
             {
                 printf(" ");
            }
        for(j=i;j<=10;j++)
            {
                printf("*");
            }
        printf("\n");
    }
 
}


 


image



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

image



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

 


image


 



#include<stdio.h>
int main()
{
    float i,j,k;
 
    for (i=1;i<=9;i++)
{
    for (k=i;k<9;k++)
    printf(" ");
    for (j=1;j<=i;j++)
    printf("*");
    printf("\n");
}
return 0;
}

 


image


 



#include<stdio.h>
int main()
{
    int i,j,k;
 
    for (i=1;i<=9;i++)
{
    for (k=i;k<9;k++)
      printf(" ");
    for (j=1;j<=i;j++)
      printf(" *");
    printf("\n");
}
return 0;
}