answersLogoWhite

0

13

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

C code for linear programming problem?

#include<stdio.h> #include<conio.h> #include<string.h> void main() { int first,last,flag=1; char str[100]; clrscr(); printf("Enter number to get to check wheather palindrome or not"); gets(str); first=0; last=strlen(str)-1; printf("%d",first); printf("%d",last); while(first<=last) { if(str[first]!=str[last]) flag=0; first++; last--; } if(flag==1) { clrscr(); printf("this is palindrome"); getch(); } else { clrscr(); printf("sorry this is not a palindrome"); getch(); } }


How do you write a class oriented program to check if any entered number is a palindrome or an Armstrong number?

Here i have declared the methods as static and passed the required variables to it. These variables can also be made implemented as data members and methods can be used to operate on them.#includeusing namespace std;class check{public:static void armgstrong(int n){int temp = n, num=0,digit;while( temp!=0){digit = temp%10;num = num*10 + digit*digit*digit;temp /= 10;}if( num == n)printf("%d is Armstrong number\n", n);elseprintf("%d is not Armstrong number\n", n);}static void palindrome( char str[]){int i=0, j=strlen(str)-1, flag = 0;for( i=0, j = strlen(str)-1; i < j && !flag; i++, j--){if( str[i] != str[j])flag = 1;}if( !flag )printf("%s is a palindrome\n", str);elseprintf("%s is not a palindrome\n", str);}};int main(){char str[40];int n;printf("Enter a number :\t");scanf("%d", &n);check::armstrong(n);//no object is need as it a static functionprintf("Enter a string :\t");scanf("%s", str);check::palindrome(str);return 0;}


To display string in a title case in c?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; #include&lt;string.h&gt; int main() { int tmp,i; char str[30]; printf("Enter any string: "); gets(str); for(i=0; str[i]!='\0'; i++) { if(str[i-1]==' ' i==0) { if(str[i]&gt;='a' &amp;&amp; str[i]&lt;='z') str[i]=str[i]-32; else if(str[i]&gt;='A' &amp;&amp; str[i]&lt;='Z') str[i]=str[i]+32; } printf("%c",str[i]); } getch(); return 0;}


A c program which will remove all the spaces from a given string?

RemoveSpaces (char *str) { char *new = str; while (*str != '\0') { if (*str != ' ') *(new++) = *str; str++; } *new = '\0'; }


How many constructors does the StringTokenizer class have?

As of Java 1.6 it has 3: StringTokenizer(String str) StringTokenizer(String str, String delim) StringTokenizer(String str, String delim, boolean returnDelims)


How do you write a C program to input a string of lowercase alphabets and convert it to uppercase using a loop?

void to_uppercase (char* str) { if (str == 0) return; while (*str != '\0') { if (*str&gt;='a' &amp;&amp; *str&lt;='z') *str-=32; ++str; } }


write aprogramme to display vowels in c?

Here's a simple C program to display vowels from a given string: #include &lt;stdio.h&gt; int main() { char str[100]; printf(&quot;Enter a string: &quot;); fgets(str, sizeof(str), stdin); printf(&quot;Vowels in the string: &quot;); for (int i = 0; str[i] != '\0'; i++) { if (str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u' || str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == 'U') { printf(&quot;%c &quot;, str[i]); } } return 0; } This program prompts the user for a string, then iterates over each character to check if it's a vowel, and displays the vowels found.


How many channels is the Sony STR DH700 AV receiver?

The Sony STR DH700 AV receiver has the power of 7.1 channels.


How do you toggle case of string in c code. Example is TogGle will turn into tOGgLE?

#include&lt;stdio.h&gt; int main() { char str[100]; int i; printf("Please enter a string: "); // gets(str); // fgets is a better option over gets to read multiword string . fgets(str, 100, stdin); // Following can be added for extra precaution for '\n' character // if(str[length(str)-1] == '\n') str[strlen(str)-1]=NULL; for(i=0;str[i]!=NULL;i++) { if(str[i]&gt;='A'&amp;&amp;str[i]&lt;='Z') str[i]+=32; else if(str[i]&gt;='a'&amp;&amp;str[i]&lt;='z') str[i]-=32; } printf("String in toggle case is: %s",str); return 0; }


How many syllables does the word strange has?

2 str/ range


What is the first word starting with str in the dictionary?

str


How do you make a str pure on rs?

Well to make a perfect str pure you would simply train your str