Thursday, June 6, 2019

Hello world program in python

""" ***********************************************
programming Language :Python
Tool(IDE) used :Anaconda -> Spider
 Write a program to that returns the - sum of squares of all odd numbers from 1 to 25

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

*****************************************************"""
print("Hello Python\n");

output:::

Note:

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

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

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

Write a program to that returns the - sum of squares of all odd numbers from 1 to 25


/* ***********************************************
    Write a program to that returns the - sum of squares of all odd numbers from 1 to 25

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

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

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


 int func(void);

 void main()
{
    printf("%d\n",func());
}
int func(void)
{
    int num, s=0;
    for(num=1;num<=25;num++)
    {
        if (num%2!=0)
             s+=num*num;
    }
    return s;
}

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 that uses a function with no arguments and no return values

/* ***********************************************
    Write a program to that uses a function with no arguments and no return values

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

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

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


void dispmenu(void);

void main()
{
int choice;
 dispmenu();
  printf("Enter your choice :\n");
   scanf("%d",&choice);

}
void dispmenu(void )
{
     printf(" 1. Create database\n");
     printf("2.Insert new record\n");
     printf("3.Modify a record\n");
     printf("4.Delete a record\n");
     printf("5.Display all records\n");
     printf("6.Exit\n");
}

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 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;
}

python class topic video