Thursday 27 June 2013

Q. Write a C program to generate pascal triangle or Write a C program to print following number triangle :







1






1
1




1
2
1


1
3
3
1
1
4
6
4
1

Solution:

#include<stdio.h>
#include<conio.h>

void main()
{
    int a,b,i,j,d[30],t[30];
    clrscr();
    printf("Enter the max limit:");
        scanf("%d",&a);
    b=a;
    for(i=0;i< a;i++)
    {

//Initialisation..
        t[0]=1; t[i]=1;
d[0]=1;

//Spacing..
        for(j=0;j< b-1;j++)
            printf(" ");
        b--;

//Calculation..
        for(j=1;j<=i;j++)
        {
        d[j]=t[j-1]+t[j];
        }
        d[i]=1;

//Printing..
        for(j=0;j<=i;j++)
        {
            printf("%d ",d[j]);
            t[j]=d[j]; //Restoring temporary Array..
        }

        printf("\n");
    }
getch();
}


Sample Output:





Note: 
 " Hi I am a Learner of C/C++. I have done this program with my own Knowledge. There may be an easy way to solve this program. So I am sorry if this program in your point of view is too long. "


10 Best moments in life

- To finish your last exam..

- To wake up and realize its
still possible to sleep "5 min" .
 

- To get a phone call saying
class is cancelled..
.
- To see an old friend again and
to feel that things have not changed..
.
 


- To touch the fingers of newly
born child..
.
- Walking alone on a silent road at night and thinking of
some good old days
memories..
.
- Riding the cycle/bike on a
highway while its raining.. .
 

- Sitting alone but you are still
smiling cause you know
someone is watching you..
.
-The calm You feel inside when you Are near to Almighty God
.
- And the last one is "right
now" while reading this
message there was constant
smile on your face..


Sunday 23 June 2013

Q. Write a program to find the given number is strong or not?

#include<stdio.h>
#include<conio.h>

void main()
{
    unsigned int n,x,l,m,fact,a=1,ans=0;
    clrscr();
    printf("\nEnter Number:");
    scanf("%d",&n);
    x=n;
    while(n> 9)
    {
        fact=1;
        l=n%10;
        n=(n-l)/10;
        m=l;
        do
        {
            fact=fact*m;
            m--;
        }
        while(m!= 0);
        ans=ans+fact;
    }
    do
    {
        a=a*n;
        n--;
    }while(n!=0);
    ans=ans+a;
    printf("\nANSWER: %d",ans);
    if(ans==x)
        printf("\nThe number is Strong");
    else
        printf("\nThe Number is not strong");
getch();

Thursday 20 June 2013

Q.Write a Program to perform array multiplication( C programming).

Array Multiplication:
Solution:
#include<conio.h>
#include<stdio.h>

void main()
{
    int a[25][25],b[25][25],c[25][25],i,j,m,n,o,k;
    clrscr();
    printf("\nEnter row & column in A:\n");
        scanf("%d\n%d",&m,&n);
    printf("\nEnter the column value in B:\n");
        scanf("%d",&o);
    printf("\nEnter %d*%d value of A\n",m,n);
    for(i=0; i< m; i++)
        for(j=0; j< n; j++)
            scanf("%d",&a[i][j]);
    printf("\nEnter %d*%d value of B\n",n,o);
    for(i=0; i< n; i++)
        for(j=0; j< o; j++)
            scanf("%d",&b[i][j]);
    printf("\nA values:\n");
    for(i=0; i< m; i++)
    {
        for(j=0; j< n; j++)
            printf("%d\t",a[i][j]);
        printf("\n");
    }
    printf("\nB values:\n");
    for(i=0; i< n; i++)
    {
        for(j=0; j< o; j++)
            printf("%d\t",b[i][j]);
        printf("\n");
    }

    for(i=0; i< m; i++)
        for(k=0; k< o; k++)
        {
            c[i][k]=0;
            for(j=0; j< n; j++)
            {
            c[i][k]=c[i][k]+a[i][j]*b[j][k];
            }
        }
    printf("\nC values:\n");
    for(i=0; i< m; i++)
    {
        for(j=0; j< o; j++)
            printf("%d\t",c[i][j]);
        printf("\n");
    }
getch();
}

Sample Output:




Note: 
 " Hi I am a Learner of C/C++. I have done this program with my own Knowledge. There may be easy way to solve this programs. So I am sorry if this program in your point of view is too long. "

Ten Steps to Improve Computer Speed( Tamil )


கணினியின் வேகத்தை அதிகரிக்க 10 வழிகள்! ! ! !

1. உங்கள் கணினியின் RAM எனப்படும் Random Access Memoryன் அளவை அதிகப்படுத்தவும் . ஒரு சாதாரண கணினிக்கு 1GB போதுமானது. அதன் நினைவகத்தின் அளவை அதிகரிக்க அதிகரிக்க வேகமும் அதிகரிக்கும். இப்போது RAM ன் விலை மிகவும் மலிவுதான்.

2. கணினியில் ஏற்கனவே நிறுவியிருக்கக் கூடிய தேவையற்ற மென்பொருட்களை நீக்கிவிடுங்கள் . புதிதாகக் கணினி வாங்கியிருந்தால்  கூட அத்துடன் ஏராளமான தேவையற்ற மென்பொருட்களையும் நிறுவி இருப்பார்கள். அவற்றில் சில மென்பொருட்கள் மட்டுமே நமக்குப்பயன்படும். மீதி அனைத்தையும் நிராகரித்து நீக்கிவிடவும்.

பழைய கணினியிலும் தேவையற்ற மென்பொருட்கள் இருப்பின் அனைத்தையும் நீக்கிவிடவும். அவற்றிற்குரிய Copy இருந்தால் அதை மட்டும் CD / DVD ல் ஏற்றி burn செய்துகொள்ளவும்.

3. FireFox, Chrome, IE என ஒன்றுக்கு மேற்பட்ட browsersஐ நிறுவி இருந்தால் அவற்றில் ஏதேனும் ஒன்றை மட்டும் வைத்துக்கொண்டு மீதியை uninstall செய்துவிடவும்.

4. G-Talk, Yahoo Messenger, Live Messenger என ஒன்றுக்கு மேற்பட்ட அரட்டை அடிக்கும் பயன்பாடுகளைத் தனித்தனியாக நிறுவி இருந்தால் எல்லாவற்றையும் uninstall செய்துவிட்டு, digsby ( http://www.digsby.com/ ) போன்ற ஒரே ஒருinstant messenger (நேரடி அரட்டை அரங்கம்) ஐ நிறுவிக் கொள்ளவும்.

5. கணினியில் Windows இயங்குதளமானது boot ஆகும்போது நிறையப் பயன்பாடுகளும் இணைந்தே துவங்கும். இதற்கு auto startup என்று பெயர். இப்படி ஏராளமான பயன்பாடுகளும் விண்டோஸ் இயங்குதளத்துடன் துவங்கினால் அதன் வேகம் மிகக் குறைந்துவிடும். http:// www.revouninstal ler.com/ பயன்படுத்தி தேவையற்ற தானியங்கிப் பயன்பாடுகளைக் கழித்துவிடவும்.

6. Startup Delayer ஐ இறக்கி அதைப் பயன்படுத்தி Autoloading பயன்பாடுகளை நீக்கிவிடலாம்.

7. Windows பயனர்கள் அதன் தேவையில்லாத animation தொந்தரவுகளால் அதன் வேகம் குறைவதை உணர்ந்திருப்பார்கள்.My Computerல் right click செய்து, advanced tabல் settingsல், Performanceல் Animate WindowsWhen minimizing and maximizingஎன்கிறதை disable செய்யவும். மேலும் தேவையில்லாதவற்றயையும் disable செய்யவும்.

8. Desktopல் இருக்கும் குறுக்குவழிச் சுட்டிகளுக்கான படங்களை அகற்றிவிடலாம். எனது நண்பர் ஒருவர் 50க்கு மேற்பட்ட desktop icons வைத்திருந்தார். அதனாலேயே அவரது கணினியின் வேகம் மிகக் குறைந்தது. தேவையில்லாத desktop ஐகான்ஸ் எல்லாவற்றையும்நீக்கியபின் கணினியின் வேகம் அதிகரித்தது.

9. கணினியில் ஒரு நெருப்புச்சுவர் (firewall), வைரசுஎதிர்ப்போன் (anti virus), ஸ்பைவேர் எதிர்ப்போன் (anti spyware) கண்டிப்பாகத் தேவை. அவற்றை அடிக்கடி புதுப்பித்துக்க கொண்டே இருக்கவேண்டும்.

10. ஆனால் இணையத்துடன் இணைந்திருக்காத தனிக் கணினிகள் மற்றும் வெளியிடத்து Floppy, CD, DVD, Pen Drive போன்றவற்றை அனுமதிக்காத கணினிகளில் மேலே கூறிய firewall, antivirus, antispyware போன்ற எதுவும் நிறுவாமல் இருந்தால் அதன் வேகம் மும்மடங்கு ஆகும் என்பதில் ஐயமில்லை.

பகிரவும் நண்பர்களே...!

Q. Write a program to get two different array values , merge them and finally produce the ascending order sorting of the result. (array Concept)-C programming

Array Concept: 
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
    int a[25],b[25],n,g=0,m,i,j,c,temp;
    clrscr();
    printf("Enter the number of a: ");
        scanf("%d",&n);
    printf("\nEnter the no of b: ");
        scanf("%d",&m);
    printf("\nEnter a values\n");
    for(i=1; i<=n ; i++)
        scanf("%d",&a[i]);
    printf("\nEnter b values\n");
    for(j=1; j<=m ; j++)
    {
        scanf("%d",&b[j]);
        a[i]=b[j];
        i++;
    }
    printf("\nMerged values:\n");
    c=n+m;
    for(i=1; i<=c; i++)
        printf("%d\t",a[i]);
    while(g < c)
    {
        for(i=1; i<=c; i++)
            if(a[i]>a[i+1])
            {
                temp=a[i];
                  a[i]=a[i+1];
                  a[i+1]=temp;
            }
            else
                a[i]=a[i];
    ++g;
    }
    printf("\nSorted Values:\n");
    for(i=1; i<=c; i++)
        printf("%d\t",a[i]);
getch();
}

Sample Output:



Note: 
 " Hi I am a Learner of C/C++. I have done this program with my own Knowledge. There may be easy way to solve this programs. So I am sorry if this program in your point of view is too long. "

Popular Posts