AKM
Sunday, 13 August 2017
Genric root of a number in single line statement in C
#include"stdio.h"
main()
{
int n;
printf("Enter a number");
scanf("%d",&n);
n%9==0?printf("9"):printf("%d",n%9);
}
Sum of Two number in single statement in C
#include"stdio.h"
main()
{
char* a=10,b=20;
printf("%d",&a[b]);
}
Find Odd or Even no in C
#include"stdio.h"
main()
{
int n;
printf("enter a number");
scanf("%d",&n);
char*x[2]={"even","odd"};
printf("%s",x[n%2]);
}
Swapping of two number in C in one line statement
#include"stdio.h"
main()
{
int x=10,y=20;
printf("%d %d",x,y);
x^=y^=x^=y;
printf("%d %d",x,y);
}
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)