Thursday, June 6, 2019

Write a program to test formal arguments

/* ***********************************************
    Write a program to test formal arguments

 date:06-06-2019
 created by:ANIL DURGAM

*****************************************************/

#include <stdio.h>
#include <stdlib.h>

main()
{
    int m=6,n=3;
     printf("%d\t",multiply(m,n));
     printf("%d\t",multiply(15,4));
     printf("%d\t",multiply(m+n,m-n));
     printf("%d\n",multiply(6,sum(m,n))) ;
}

int multiply(int x,int y)
{
     int p;
      p=x*y;
       return p;
}

int sum (int x , int y)
{
    return x+y;
}



output:::



Note:

please send the questions which you are facing problem in C Language.

also write interview questions which are you faced in during interview related to C Language.

so i can try to solve them and send you back.

Write a program to factorial of the given number

/* ***********************************************
    Write a program to factorial of the given number

 date:06-06-2019
 created by:ANIL DURGAM

*****************************************************/


#include <stdio.h>
#include <stdlib.h>


long int factorial(int n);
int main()
{
    int a,b;
    printf("enter the number\n");
    scanf("%d",&a);
    //b=factorial(a);
    printf("factorial==%ld",factorial(a));
    return 0;
}

long int factorial(int n)
{
    int i;
    long int fact = 1;
    if (n==0)
        return 1;
    for(i=n;i>1;i--)
        fact*=i;
    return fact;

}
out put:::

program 2:

#include<stdio.h>
long fact(int n);
void main()
{
    int num;
    printf("Enter a number\n");
    scanf("%d",&num);
    printf("Factorial of %d is %ld\n", num,fact(num)) ;
}
long fact(int n)
{
    if (n==0)
        return(1);
    else
        return(n*fact(n-1));

}

output::
Enter a number
12
Factorial of 12 is 479001600

Note:

please send the questions which you are facing problem in C Language.

also write interview questions which are you faced in during interview related to C Language.

so i can try to solve them and send you back.

Write a program to find the given number is smaller or larger

/* ***********************************************
    Write a program to find the given number is smaller  or larger

 date:06-06-2019
 created by:ANIL DURGAM

*****************************************************/




#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c;
    printf("Enter the number\n");
    scanf("%d%d",&a,&b);
    small_large_fn(a,b);

    return 0;
}
int  small_large_fn(int a,int b)
{
    if(a>b)
    {
        printf("a is bigger number\n");

    }
     else if(a<b)
    {
        printf("b is bigger number\n");
    }
    else
    {
        printf("both numbers are equal\n");
    }

}

out put:::


Note:

please send the questions which you are facing problem in C Language.

also write interview questions which are you faced in during interview related to C Language.

so i can try to solve them and send you back.

Write a program to find the given number is even or odd using functions

/* ***********************************************
    Write a program to find the given number is even or odd using functions

 date:06-06-2019
 created by:ANIL DURGAM

*****************************************************/


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b;
    printf("Enter a number\n");
    scanf("%d",&a);
    b=even_odd_fn(a);
    if(b==0)
    {
        printf("even number\n");
    }
    else
        {
            printf("odd number\n");
        }
    return 0;
}
  int  even_odd_fn(a)
  {
    int n=0;
    n=a%2;
    return n;


  }


out put:::



Note:
please send the questions which you are facing problem in C Language.
also write interview questions which are you faced in during interview related to C Language.
so i can try to solve them and send you back.

Wednesday, June 5, 2019

Write a program to add two numbers using functions

/* ***********************************************
    Write a program to add two numbers using functions

 date:06-06-2019
 created by:ANIL DURGAM

*****************************************************/


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c;
    printf("please enter two numbers\n");
    scanf("%d%d",&a,&b);

    c=sum(a,b);
    printf("sum=%d",c);
    return 0;
}
int sum(int a, int b)
{
    int c;
    c=a+b;
    return c;
}



Write a program to draw a line

/* ***********************************************
    Write a program to draw a line

 date:06-06-2019
 created by:ANIL DURGAM

*****************************************************/

#include <stdio.h>
#include <stdlib.h>

int main()
{
    drawline();
    return 0;
}


int drawline(void)
{
    int i;
    for(i=0;i<80;i++)
    {
        printf("-");

    }


}




Tuesday, June 4, 2019

Write a program to print the numbers using the do while

/* ***********************************************
    Write a program to print the numbers using the do while

 date:04-06-2019
 created by:ANIL DURGAM

*****************************************************/

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i=0;
    do{

         printf("%d\n",i);
    i+=1;

    }while(i<=10);


    return 0;
}



Write a program to convert binary number to decimal number

/* ***********************************************
    Write a program to convert binary number to decimal number

 date:04-06-2019
 created by:ANIL DURGAM

*****************************************************/


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,nsave,rem,d,j=1,dec=0;
    printf("Enter the binary number\n");
    scanf("%d",&n);
    nsave=n;
    while(n>0)
    {
        rem=n%10;
        d=rem*j;
        dec+=d;
        j*=2;
        n/=10;
    }
    printf("binary num==%d,Decimal number=%d\n",nsave,dec);

    return 0;
}

















program 2:

#include <stdio.h>
#include <stdlib.h>

long binary (long int num);
main()
{
    long int num;
    printf("Enter the decimal number\n");
    scanf("%ld",&num) ;
    printf("Decimal=%ld,Binary=%ld\n",num,binary(num));
}
long binary(long int num)
{
long rem,a=1,bin=0;
while(num>0)
{
    rem=num%2;
    bin=bin+rem*a;
    num/=2;
    a*=10;
}
    return bin;
}

Monday, June 3, 2019

Write a program to count the individual numbers of the given number


/* ***********************************************
    Write a program to count the individual numbers of the given number

 date:03-06-2019
 created by:ANIL DURGAM

*****************************************************/


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int sum=0,n,rem=0;
    printf("please enter the number\n");
    scanf("%d",&n);

    while(n>0)
    {
        rem=n%10;
        sum+=rem;
        n/=10;
    }
    printf("sum of the digits of the given number is ==%d\n",sum);
    return 0;
}



Write a program to print 1 to 10 using while loop


/* ***********************************************
    Write a program to print 1 to 10 using while loop

 date:03-06-2019
 created by:ANIL DURGAM

*****************************************************/

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i=1;
    while(i<=10)
    {
         printf("%d\n",i);
         i++;

    }

    return 0;
}



Write a program to find the grade of the student


/* ***********************************************
    Write a program to find the grade of the student
    of the 4 subjects

 date:03-06-2019
 created by:ANIL DURGAM


 program details
 per>=85                        Grade =A
 per>70 && below per <85        Grade=B
 per>55 && beloW per<=70        Grade=C
 per>=40 && beloW per<=55       Grade=D
 per<40                         Grade=E

*****************************************************/

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int m1,m2,m3,m4,total,percent;
    char Grade;
    printf("please enter the marks of four subjects\n");
    scanf("%d%d%d%d",&m1,&m2,&m3,&m4);
    //printf("m1=%d,m2=%d,m3=%d,m4=%d\n",m1,m2,m3,m4);
    total=(m1+m2+m3+m4)/4;
    if(total>=85)
        Grade='A';
    else if(total<85 && total>=70)
        Grade='B';
    else if(total<70 && total>=55)
        Grade='C';
    else if(total<55 && total>=40)
        Grade='D';
    else if(total<40)
        Grade='E';


    printf("avg=%d\nGrade==%c\n",total,Grade);
    return 0;
}



python class topic video