#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
Title |
Name |
Language |
UNIX |
When |
Re: Re: CSE 2.1 CL2 |
CL5 |
text |
1695291421 |
1 Year ago. |
CL5 |
DW |
text |
1694688669 |
1 Year ago. |
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}