1. Write a c program to reverse any number.

2. Write a c program to find out sum of digit of given number.

2. Write a c program to find out sum of digit of given number.

10. Write a c program to find out NCR factor of given number.

11. How to convert string to int without using library functions in c

12. Program in c to print 1 to 100 without using loop

13. C program for swapping of two numbers

14. Program to find largest of n numbers in c

15. Split number into digits in c programming

16. C program to count number of digits in a number

11. How to convert string to int without using library functions in c

12. Program in c to print 1 to 100 without using loop

13. C program for swapping of two numbers

14. Program to find largest of n numbers in c

15. Split number into digits in c programming

16. C program to count number of digits in a number

the first program should have

ReplyDeleteb=temp;

logic: swapping

ReplyDeletea=a+b;

b=a-b;

a=a-b;

in the program for swapping 2 nos. it should be *temp= *ptra

ReplyDeleteswapping without 3rd variable

ReplyDeletea=a+b-a;

b=a+b-b;

its wnt work... :|

Deletea=a^b;

b=a^b;

a=a^b;

yaa itz right

DeleteThis is single line logic:

Deleteb = b + a - (a = b);

swapping using ptr is wrong..

ReplyDeleteshould be

int temp;

temp=*a;

there r lots of mistakes

ReplyDeleteThis comment has been removed by the author.

ReplyDeleteswapping in oneline is needed?

ReplyDeleteVery Nice Article helps a lot ...

ReplyDeleteYou can also find 6 type of logic to swap two number here check one it will be helpful ...

Swapping of two numbers

Very Nice Article helps a lot ...

ReplyDeleteYou can also find 6 type of logic to swap two number here check one it will be helpful ...

Swapping of two numbers

This comment has been removed by the author.

ReplyDeletealso use this

ReplyDelete==========

a=a-(~b)-1

b=a+(~b)+1

a=a+(~b)+1

=========

here ~b=(-b-1)

Superb nice

DeleteSuperb nice

DeleteGood logic for swapping of 2 nos

Deleteneed to keep * in temp assigning in swap function

ReplyDeletelogic is wrong for swapping using function...

ReplyDeletecorrect one iis

void swap(int*a,int*b)

{

int temp;

temp=*b;

*b=*a;

*a=temp;

}