Posts

Showing posts from December 1, 2019

C Program To Accept The String Starting With 01 And Ending With 011 | C Programming

Image
C Program To Accept The String Starting With 01 And Ending With 011 #include <stdio.h> #include <string.h> int main () {     char str [ 10 ];     int len, i, q = 0 ;     printf ( "enter the string which only contain 0 and 1 \n " );     scanf ( " %s " , str);     len = strlen (str);     for (i = 0 ; i <= len; i++)     {         if ( str [i] == '0' && q == 0 )             q = 1 ;         else if ( str [i] == '1' && q == 0 )             q = 6 ;         else if ( str [i] == '0' && q == 1 )             q = 6 ;         else if ( str [i] == '1' && q == 1 )             q = 2 ;         else if ( str [i] == '0' && q == 2 )             q = 3 ;         else if ( str [i] == '1' && q == 2 )             q = 2 ;         else if ( str [i] == '0' && q == 3 )             q = 3 ;         else if ( str [i] == '1' &&a

C Program To Accept The String Starting With ab And Ending With abb | C Programming

Image
C Program To Accept The String Starting With ab And Ending With abb  #include <stdio.h> #include <string.h> int main ( int argc , char const * argv []) {     char str [ 10 ];     int len, i, q = 0 ;     printf ( "enter the string which only contain a and b \n " );     scanf ( " %s " , str);     len = strlen (str);     for (i = 0 ; i <= len; i++)     {         if ( str [i] == 'a' && q == 0 )             q = 1 ;         else if ( str [i] == 'b' && q == 0 )             q = 6 ;         else if ( str [i] == 'a' && q == 1 )             q = 6 ;         else if ( str [i] == 'b' && q == 1 )             q = 2 ;         else if ( str [i] == 'a' && q == 2 )             q = 3 ;         else if ( str [i] == 'b' && q == 2 )             q = 2 ;         else if ( str [i] == 'a' && q == 3 )             q = 3 ;         else i

Variables in C

Image
Variables in C Programmings:- "Variable in C" variables names are case sensitive whose value can change any time. It is a memory location used to store data value. A variable name in C variables should be carefully chosen so that its use is reflected in a useful way in the entire program.  Rules for declaring variables in C Programming:- They must always begin with a letter, although some systems permit underscore as the first character. The length of a variable must not be more than 8 characters. White space is not allowed and A variable should not be a Keyword It should not contain any special characters.  In C variables A variable declaration provides assurance to the compiler that there exists a variable with the given type and name so that the compiler can proceed for further compilation without requiring the complete detail about the variable. A variable definition has its meaning at the time of compilation only, the compiler needs actual variable