Facebook
From CL4, 8 Months ago, written in Plain Text.
This paste is a reply to CSE 2.1 CL2 from MSE - go back
Embed
Viewing differences between CSE 2.1 CL2 and Re: CSE 2.1 CL2
#include #includeh>

int main() {
    // Write C++ code here
    
    
{

    char line[100];
    
int i=1,j;
    
i, j, num, count=0;
    char vowels[11] = "aeiouAEIOU";
    
printf("Enter the number you wish to print: a string: ");
    scanf("%d", &j);
    printf("\nUsing while loop:\n");
    while (i<=j) 
        {
            printf("%d\t",i);
            i++;
        }
    
    i--;
    printf("\n\nOn the Reverse Order:\n");
    while (i>=1)
        {
            printf("%d\t",i);
            i--;
        
gets(line);

    for (i = 0; line[i] != '\0'; i++);
    num = i;


    for(i = num-1; i >= 0; i--) {
        printf("%c", line[i]);
    }

    printf("\nThe vowels are:");
    for(i=0; line[i]!='\0'; i++)
            {
                for(j=0; vowels[j]!='\0'; j++)
                    {
                        if(line[i]==vowels[j])
                            {
                                count++;
                                printf("%c",line[i]);
                            }
                    }
              
}
    printf("\n\nUsing for loop:\n");
    for (i=1;i<=j;i++) 
        {
            printf("%d\t",i);
        }
    i--;
    printf("\n\nOn the Reverse Order:\n");
    for (;i>=1;i--)
        {
            printf("%d\t",i);
        }
    printf("\n\nUsing for do while:\n");
    do { printf("%d\t",i), 
            i++; }
    while (i<=j);
    
    i--;
    printf("\n\nOn the Reverse Order:\n");
    do { printf("%d\t",i);
            i--; }
    while (i>=1);
    
printf("\nNumber of vowels = %d", count);



    return 0;
}


int main() {
    // Write C++ code here
    
    int i, RN;
    printf("Enter the number: ");
    scanf("%d",&i);

    for (int j=1; j <= i; j++)
        
        {
            if (i % j == 0)
            {
            printf("%d\n",j);}
        }
    
    while ( i != 0)
        { int digit  = i % 10;
        RN = RN * 10 + digit;
        i = i / 10; }
        
        printf("reversed number: %d\n", RN);
        
    
    return 0;
}
}

Replies to Re: CSE 2.1 CL2 rss

Title Name Language When
Re: Re: CSE 2.1 CL2 CL5 text 7 Months ago.
CL5 DW text 8 Months ago.