10. Write a c program to add two numbers without using addition operator.
11. Write a c program to subtract two numbers without using subtraction operator.
15. Write a c program to solve quadratic equation.
18. Write a c program which passes structure to function.
28. Write a c program which takes password from user.
29. Write a scanf function in c which accept sentence from user.
30. Write a scanf function in c which accept paragraph from user.
15 comments:
here in the above program
char str[10],rev[10];
its cannot be pointer as it is holding the array length
thnx for d programs.
can any1 explain dis program in detail
wat about this..
void checkpalindrome(char* inString)
{
int i, j;
int len = strlen(inString);
for(i = 0, j = strlen(inString)-1; i > len\2 && j > len\2; i++, j--)
{
if(inString[i] != inString[j])
break;
}
if(i == len/2 && j == len\2)
printf("Palindrome\n");
else
printf("Not palindrome\n");
}
}
i got output thank u so much
I find my answer thank u
ye program chalega hi nhiiiiiiiiiiii
bhai yeh program ni chalega
There is one more approach to solve the above problem.
The iterations of this program is half of the above mentioned solution.
#include
#include
main()
{
char str[25];
int i, j, isPalindrome = 1;
scanf("%s",str);
for(j = 0, i = strlen(str)-1; j <= i; j++, i--)
{
if(str[j] != str[i])
{isPalindrome = 0; break;}
}
if(isPalindrome)
printf("%s is pallindrome",str);
else
printf("This is not pallindrome");
}
#include
#include
#include
int main()
{
char s[50], r[50]={'\0'};
int i,l = 0, f = 0;
printf("Enter a string\n");
gets(s);
for (i=0; s[i] != '\0'; i++)
{
l++;
}
for (i=l-1; i >= 0 ; i--)
{
r[l-i-1] = s[i];
}
for (i=0; i < l ; i++)
{
if (r[i] == s[i])
f = 1;
else
f = 0;
}
if (f == 1)
printf ("%s is a palindrome\n", s);
else
printf("%s is not a palindrome\n", s);
return 0;
}
#include
#include
#include
void mai()
{
char a[20],b[20];
clrscr();
printf("\n\n\n\t\t\t Enter the String \n");
gets(a);
strcpy(b,a);
strrev(b);
if(strcmp(a,b)==0);
{
printf("\n\t\t\t\t given string is Palindrome\n");
}
else
{
printf("\n\t\t\t\t given string is not a Palindrome\n");
}
getch();
}
this is the fully friendly site of c programming...... thanks all over frinds and c-question organization
and what finding symmetric word ,its place at string?
Six different easy ways to find whether a string or number is palindrome or not in C Programming
http://www.waytosmart.com/tutorials/c-programming/six-different-easy-ways-to-find-whether-a-string-or-number-is-palindrome-or-not-in-c-programming.php
here we are not allocating any specific memory for to store that strings.how it possible to get the string.
Post a Comment