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);
}
Posted by Amit at 22:46 No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

Sum of Two number in single statement in C

#include"stdio.h"
main()  
{      
char* a=10,b=20;
printf("%d",&a[b]);
} 
Posted by Amit at 11:37 No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

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

Posted by Amit at 11:21 No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

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);
}
Posted by Amit at 11:12 No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

About me

Amit
View my complete profile

Blog Archive

  • ►  2022 (1)
    • ►  March (1)
  • ►  2018 (15)
    • ►  October (1)
    • ►  August (1)
    • ►  April (6)
    • ►  March (7)
  • ▼  2017 (4)
    • ▼  August (4)
      • Genric root of a number in single line statement in C
      • Sum of Two number in single statement in C
      • Find Odd or Even no in C
      • Swapping of two number in C in one line statement
  • ►  2016 (1)
    • ►  October (1)
Watermark theme. Powered by Blogger.