embedded system,Arduino,Raspberry pi,ARM7,MM32,STM32,PIC and Python,Django,Datascience and web development
Tuesday, June 11, 2019
find the large value in given two integer using function in c
#include <stdio.h>
/* function declaration */
int max(int num1, int num2);
int main () {
int a;
int b;
int ret;
printf("enter the values\n");
scanf("%d%d",&a,&b);
ret = max(a, b);
printf( "Max value is : %d\n", ret );
return 0;
}
/* function returning the max between two numbers */
int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
/* function declaration */
int max(int num1, int num2);
int main () {
int a;
int b;
int ret;
printf("enter the values\n");
scanf("%d%d",&a,&b);
ret = max(a, b);
printf( "Max value is : %d\n", ret );
return 0;
}
/* function returning the max between two numbers */
int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
output::
little compressed the program:
#include <stdio.h>
/* function declaration */
int max(int num1, int num2);
int main () {
int a,b,ret;
printf("enter the values\n");
scanf("%d%d",&a,&b);
ret = max(a, b);
printf( "Max value is : %d\n", ret );
return 0;
}
/* function returning the max between two numbers */
int max(int num1, int num2)
{
if (num1 > num2)
return num1;
else
return num2;
}
#include <stdio.h>
/* function declaration */
int max(int num1, int num2);
int main () {
int a,b,ret;
printf("enter the values\n");
scanf("%d%d",&a,&b);
ret = max(a, b);
printf( "Max value is : %d\n", ret );
return 0;
}
/* function returning the max between two numbers */
int max(int num1, int num2)
{
if (num1 > num2)
return num1;
else
return num2;
}
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.
swap using functions in c
#include <stdio.h>
/* function declaration */
void swap(int x, int y);
int main () {
/* local variable definition */
int a = 100;
int b = 200;
printf("Before swap, value of a : %d\n", a );
printf("Before swap, value of b : %d\n", b );
/* calling a function to swap the values */
swap(a, b);
printf("After swap, value of a : %d\n", a );
printf("After swap, value of b : %d\n", b );
return 0;
}
/* function definition to swap the values */
void swap(int x, int y) {
int temp;
temp = x; /* save the value of x */
x = y; /* put y into x */
y = temp; /* put temp into y */
return;
}
/* function declaration */
void swap(int x, int y);
int main () {
/* local variable definition */
int a = 100;
int b = 200;
printf("Before swap, value of a : %d\n", a );
printf("Before swap, value of b : %d\n", b );
/* calling a function to swap the values */
swap(a, b);
printf("After swap, value of a : %d\n", a );
printf("After swap, value of b : %d\n", b );
return 0;
}
/* function definition to swap the values */
void swap(int x, int y) {
int temp;
temp = x; /* save the value of x */
x = y; /* put y into x */
y = temp; /* put temp into y */
return;
}
output::
extern keyword
#include <stdio.h>
// Variable declaration:
extern int a, b;
extern int c;
extern float f;
int main () {
/* variable definition: */
int a, b;
int c;
float f;
/* actual initialization */
a = 10;
b = 20;
c = a + b;
printf("value of c : %d \n", c);
f = 70.0/3.0;
printf("value of f : %f \n", f);
return 0;
}
// Variable declaration:
extern int a, b;
extern int c;
extern float f;
int main () {
/* variable definition: */
int a, b;
int c;
float f;
/* actual initialization */
a = 10;
b = 20;
c = a + b;
printf("value of c : %d \n", c);
f = 70.0/3.0;
printf("value of f : %f \n", f);
return 0;
}
output::
Monday, June 10, 2019
float values testing in c
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <float.h>
int main(int argc, char** argv) {
printf("Storage size for float : %d \n", sizeof(float));
printf("FLT_MAX : %g\n", (float) FLT_MAX);
printf("FLT_MIN : %g\n", (float) FLT_MIN);
printf("-FLT_MAX : %g\n", (float) -FLT_MAX);
printf("-FLT_MIN : %g\n", (float) -FLT_MIN);
printf("DBL_MAX : %g\n", (double) DBL_MAX);
printf("DBL_MIN : %g\n", (double) DBL_MIN);
printf("-DBL_MAX : %g\n", (double) -DBL_MAX);
printf("Precision value: %d\n", FLT_DIG );
return 0;
}
#include <stdlib.h>
#include <limits.h>
#include <float.h>
int main(int argc, char** argv) {
printf("Storage size for float : %d \n", sizeof(float));
printf("FLT_MAX : %g\n", (float) FLT_MAX);
printf("FLT_MIN : %g\n", (float) FLT_MIN);
printf("-FLT_MAX : %g\n", (float) -FLT_MAX);
printf("-FLT_MIN : %g\n", (float) -FLT_MIN);
printf("DBL_MAX : %g\n", (double) DBL_MAX);
printf("DBL_MIN : %g\n", (double) DBL_MIN);
printf("-DBL_MAX : %g\n", (double) -DBL_MAX);
printf("Precision value: %d\n", FLT_DIG );
return 0;
}
output::
size for each data types in c
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <float.h>
int main(int argc, char** argv) {
printf("CHAR_BIT : %d\n", CHAR_BIT);
printf("CHAR_MAX : %d\n", CHAR_MAX);
printf("CHAR_MIN : %d\n", CHAR_MIN);
printf("INT_MAX : %d\n", INT_MAX);
printf("INT_MIN : %d\n", INT_MIN);
printf("LONG_MAX : %ld\n", (long) LONG_MAX);
printf("LONG_MIN : %ld\n", (long) LONG_MIN);
printf("SCHAR_MAX : %d\n", SCHAR_MAX);
printf("SCHAR_MIN : %d\n", SCHAR_MIN);
printf("SHRT_MAX : %d\n", SHRT_MAX);
printf("SHRT_MIN : %d\n", SHRT_MIN);
printf("UCHAR_MAX : %d\n", UCHAR_MAX);
printf("UINT_MAX : %u\n", (unsigned int) UINT_MAX);
printf("ULONG_MAX : %lu\n", (unsigned long) ULONG_MAX);
printf("USHRT_MAX : %d\n", (unsigned short) USHRT_MAX);
return 0;
}
#include <stdlib.h>
#include <limits.h>
#include <float.h>
int main(int argc, char** argv) {
printf("CHAR_BIT : %d\n", CHAR_BIT);
printf("CHAR_MAX : %d\n", CHAR_MAX);
printf("CHAR_MIN : %d\n", CHAR_MIN);
printf("INT_MAX : %d\n", INT_MAX);
printf("INT_MIN : %d\n", INT_MIN);
printf("LONG_MAX : %ld\n", (long) LONG_MAX);
printf("LONG_MIN : %ld\n", (long) LONG_MIN);
printf("SCHAR_MAX : %d\n", SCHAR_MAX);
printf("SCHAR_MIN : %d\n", SCHAR_MIN);
printf("SHRT_MAX : %d\n", SHRT_MAX);
printf("SHRT_MIN : %d\n", SHRT_MIN);
printf("UCHAR_MAX : %d\n", UCHAR_MAX);
printf("UINT_MAX : %u\n", (unsigned int) UINT_MAX);
printf("ULONG_MAX : %lu\n", (unsigned long) ULONG_MAX);
printf("USHRT_MAX : %d\n", (unsigned short) USHRT_MAX);
return 0;
}
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.
Friday, June 7, 2019
Write a program to sum of entered number
/* ***********************************************
Write a program to sum of entered number
date:07-06-2019
created by:ANIL DURGAM
*****************************************************/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,sum=0;
do{
printf("enter a number(0 to stop)\n");
scanf("%d",&a);
sum+=a;
}while(a!=0);
printf("sum is =%d\n",sum);
return 0;
}
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 count the digits in the given number
/* ***********************************************
Write a program to count the digits in the given number
date:07-06-2019
created by:ANIL DURGAM
*****************************************************/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,count=0,rem;
printf("enter the number\n");
scanf("%d",&a);
do{
a/=10;
count++;
}while(a>0);
printf("number of digits==%d\n",count);
return 0;
}
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.
variable declaration in python
example 1:
print('3'+'5')
a='3'
b='5'
c=a+b
print(c)
print(type(c))
output:
35
35
<class 'str'>
example 1:
Favoritecolor="red"
favoritecolor="yellow"
print(Favoritecolor,"\n",favoritecolor)
output:
red
yellow
print('3'+'5')
a='3'
b='5'
c=a+b
print(c)
print(type(c))
output:
35
35
<class 'str'>
example 1:
Favoritecolor="red"
favoritecolor="yellow"
print(Favoritecolor,"\n",favoritecolor)
output:
red
yellow
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:::
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.
Subscribe to:
Posts (Atom)
-
1. Write a program to accept the integer value and print its table. Note: ...









