Skip to main content

Posts

Showing posts from July, 2013

60 TIPS FOR A STUNNINGLY GREAT LIFE by Robin Sharma

http://www.robinsharma.com/blog/12/60-tips-for-a-stunningly-great-life/ Exercise daily. 2. Get serious about gratitude. 3. See your work as a craft. 4. Expect the best and prepare for the worst. 5. Keep a journal. 6. Read “The Autobiography of Benjamin Franklin” . 7. Plan a schedule for your week. 8. Know the 5 highest priorities of your life. 9. Say no to distractions. 10. Drink a lot of water. 11. Improve your work every single day. 12. Get a mentor. 13. Hire a coach. 14. Get up at 5 am each day. 15. Eat less food. 16. Find more heroes. 17. Be a hero to someone. 18. Smile at strangers. 19. Be the most ethical person you know. 20. Don’t settle for anything less than excellence. 21. Savor life’s simplest pleasures. 22. Save 10% of your income each month. 23. Spend time at art galleries. 24. Walk in the woods. 25. Write thank you letters to those who’ve helped you. 26. Forgive those who’ve wronged you. 27. Remember that leadership is about influence and imp

Implementing strlen() function in c

Steps:- read a string from keyboard pass string to a function as pointer increment the string pointer and i till it encounters null ('\0') and while fails return the length to main program /* C program */ #include<stdio.h> #include<stdlib.h> /* program- calculate the lengh of the string (strlen()) Author:- Surendra Patil Date:- july 11 2013 */ int str_len(char *); int main() {   char *str = NULL;   /* allocate soutput:-ome memory */   str = (char*)malloc(20*sizeof(char));   printf("Enter the string \n");   scanf("%s",str);   printf("Length of the string = %d\n",str_len(str)); return 0; }  /* Function returns the length of the string */ int str_len (char *string) {   int i =0;   /* increment the pointer till end of the string */   while(*string++)    ++i;   re

power function to calculate pow(x,y)

#include<stdio.h> /* Program:- power function to calculate pow(x,y)  * Author:-  Surendra Patil  * Date:-    10th July 2013 */ /* power func prototype */ int power(int,int); int main () {         int m,n;         printf("Enter the value of n and m \n");         scanf("%d %d",&m,&n);         printf (" power = %d\n",power(m,n));         return 0; } int power(int base,int n) {         int i,result = 1;         for (i=1;i <=n;i++)                 result *= base;         return result; } Input:- Enter the value of n and m 3  4 Output:- Power = 81

C program to suppress the multiple space and tabs in a line

--> C program to suppress the multiple space and tabs in a line of input to single space,(Dennis Ritchie exercise 1.9 page 19. #include<stdio.h> /* Copy and replace multiple blanks and tabs by single space Autor:- Surendra Patil Date:- july 9th 2013 */ int main() { int c; printf("\n enter the input with tabs and spaces \n"); while ((c=getchar()) != EOF) {   if(c ==' ' || c == '\t') {      putchar(' ');      /* squeze all the blanks and tabs */     while ( ((c = getchar()) != EOF) && (c == ' ' || c == '\t'));   }    putchar(c); } return 0; } Input:- surendra patil nidasoshi Output:- surendra patil nidasoshi