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

while(str[i]!='\0'){

ReplyDeleteif(str[i]< 48 || str[i] > 57){

printf("Unable to convert it into integer.\n");

return 0;

}

else{

sum = sum*10 + (str[i] - 48);

i++;

}

for this part, i do not understand the str[i] is smaller than 48 and larger than 57?

Can you explain it again?

str[i] will return ASCII value of that character. ASCII value of '0' is 48 and '9' is 57.

ReplyDeletecan any one write the full c program for day number for example 04-feb-2012 must be printed as 35 2012

ReplyDeletemeans jan as 31 days so 31+4=35

how can i print prime number in if else condition with out using loop;

ReplyDeletemay i put

ReplyDeletesum = sum*10 + (str[i] );

instead of

sum = sum*10 + (str[i] - 48); ?

and here 48 means 0?

c++ please?

ReplyDelete