Monday, 23 December 2013


/*TO CALCULATE THE LENGTH OF THE STRING*/

INPUT

#include<conio.h>
#include<stdio.h>
int main()
{
char str[40];
int i;
printf("\nEnter the string to calculate its string");
gets(str);
for(i=0;str[i]!='\0';i++)
i=i+1;
printf("\nThe length of entered string is: %d",i);
getch();
return 0;
}

OUTPUT



Please give your comment , so I could improve this blog.

Friday, 20 December 2013

/*TO FIND THE SUM OF ENTERED NUMBER USING FUNCTIONS*/


OUTPUT





INPUT

#include<conio.h>
#include<stdio.h>
void sumof()
{
int num,temp,r,sum=0;
printf("Enter a number");
scanf("%d",&num);
temp=num;
while(temp>0)
{
r=temp%10;
sum=sum+r;
temp=temp/10;
}
printf("The sum of entered number is %d",sum);
}
void main()
{
sumof();
}