URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       Learners Tech
  HTML https://learnerstech.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Question Board
       *****************************************************
       #Post#: 10--------------------------------------------------
       Question No.1
   DIR By: MohanKestrel
       Date: July 5, 2017, 12:27 pm
       ---------------------------------------------------------
       A for loop is a programming language statement which allows code
       to be repeatedly executed.
       The syntax for this is
       for ( <expression_1> ; <expression_2> ; <expression_3> )
       <statement>
       expression_1 is used for intializing variables which are
       generally used for controlling terminating flag for the loop.
       expression_2 is used to check for the terminating condition. If
       this evaluates to false, then the loop is terminated.
       expression_3 is generally used to update the flags/variables.
       A sample loop will be
       for(int i = 0; i < 10; i++) {
       ...
       }
       Input Format
       You will be given two positive integers, a  and  b (a<=b),
       separated by a newline.
       Output Format
       For each integer n in the interval  a to b,
       If 1<=n<=9, then print the English representation of it in
       lowercase. That is "one" for 1 , "two" for 2, and so on.
       Else if n>9  and it is an even numeber, then print "even".
       Else if n>9 and it is an odd number, then print "odd".
       Sample Input
       8
       11
       Sample Output
       eight
       nine
       even
       odd
       Try this question and answer this (with code) within 48 hours
       after that the answer will be posted.
       If you have any doubts about this question you can discuss or
       ask a question in comments.
       We are here to help you... :) :)
       #Post#: 11--------------------------------------------------
       Re: Question No.1
   DIR By: MohanKestrel
       Date: July 5, 2017, 12:27 pm
       ---------------------------------------------------------
       Is it the qstn to write a prgrm to print the name of the num?
       by Sangeetha
       #Post#: 12--------------------------------------------------
       Re: Question No.1
   DIR By: MohanKestrel
       Date: July 5, 2017, 12:28 pm
       ---------------------------------------------------------
       Yes, you should display the name of in between numbers which you
       have given as an input.
       But the number names is upto 9 only. When the number is greater
       than 9 you should display whether the number is odd or even.
       For example,
       You are giving input as 6 and 12. the output is as
       Six
       seven
       eight
       nine
       even
       odd
       since 10 is even number and 11 is odd number
       #Post#: 13--------------------------------------------------
       Re: Question No.1
   DIR By: MohanKestrel
       Date: July 5, 2017, 12:29 pm
       ---------------------------------------------------------
       #include<stdio.h>
       #include<conio.h>
       int main()
       {
       int a,b,n,i;
       clrscr();
       printf("enter the values:");
       scanf("%d\n%d",&a,&b);
       printf("enter the no of values:");
       scanf("%d",&n);
       for(i=1;i<=n;i++)
       {
       switch(a)
       {
       case 1:
       printf("one\n");
       a++;
       break;
       case 2:
       printf("two\n");
       a++;
       break;
       case 3:
       printf("three\n");
       a++;
       break;
       case 4:
       printf("four\n");
       a++;
       break;
       case 5:
       printf("five\n");
       a++;
       break;
       case 6:
       printf("six\n");
       a++;
       break;
       case 7:
       printf("seven\n");
       a++;
       break;
       case 8:
       printf("eight\n");
       a++;
       break;
       case 9:
       printf("nine\n");
       a++;
       break;
       case 10:
       printf("even\n");
       a++;
       break;
       case 11:
       printf("odd\n");
       a++;
       break;
       case 12:
       printf("even\n");
       break;
       }
       }
       getch();
       return 0;
       }
       
       
       by janani
       #Post#: 14--------------------------------------------------
       Re: Question No.1
   DIR By: MohanKestrel
       Date: July 5, 2017, 12:29 pm
       ---------------------------------------------------------
       Kudos fr ur try....
       Bt u cant print the values when u enter fr more than...12..so
       try to make it clear
       by Karthi
       #Post#: 17--------------------------------------------------
       Re: Question No.1
   DIR By: Karthikeyan
       Date: July 7, 2017, 1:38 am
       ---------------------------------------------------------
       Then its fr d answer tym.....
       #include<stdio.h>
       #include<conio.h>
       int main()
       {
       int a,b,i;
       clrscr();
       printf("enter the values:");
       scanf("%d\n%d",&a,&b);
       for(i=a;i<=b;i++)
       {
       switch(i)
       {
       case 1:
       printf("one\n");
       break;
       case 2:
       printf("two\n");
       break;
       case 3:
       printf("three\n");
       break;
       case 4:
       printf("four\n");
       break;
       case 5:
       printf("five\n");
       break;
       case 6:
       printf("six\n");
       break;
       case 7:
       printf("seven\n");
       break;
       case 8:
       printf("eight\n");
       break;
       case 9:
       printf("nine\n");
       break;
       Default:
       if(i%2==0)
       printf("even\n");
       break;
       else
       printf("odd\n");
       break;
       }
       }
       getch();
       return 0;
       }
       #Post#: 19--------------------------------------------------
       Re: Question No.1
   DIR By: MohanKestrel
       Date: July 8, 2017, 9:29 am
       ---------------------------------------------------------
       This is another answer
       #include<stdio.h>
       #include<conio.h>
       #include<string.h>
       void main()
       {
       int a,b,i;
       char
       *arr[9]={"one","two","three","four","five","six","seven","eight","nine"};
       printf("enter the number:\n");
       scanf("%d  %d",&a,&b);
       for(i=a;i<=9;i++)
       {
       printf("%s\n",arr[i-1]);
       }
       for(i=10;i<=b;i++)
       {
       if(i%2==0)
       printf("even\n");
       else
       printf("odd\n");
       }
       }
       *****************************************************
       Page 1 of 1