Write a c program using for loop in switch case?
Answer / mmm
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
int code;
clrscr();
printf("menu\n");
printf("\npress 1 for positive numbers");
printf("\npress 2 for negitive numbers");
printf("enter code(1or2)");
scanf("%d",&code);
switch(code)
{
case 1: printf("\nfirst 10 positive numbers:");
for(i=0;i<10;i++)
printf("%d\n",i);
break;
case 2: printf("\nfirst 10 negative numbers:");
for(i=0;i<10;i++)
printf("-%d\n",i);
break;
default:printf("invalid code");
}
// printf("do you want to continue:yes or no");
getch();
}
| Is This Answer Correct ? | 41 Yes | 2 No |
accept character from keyboard untill the user presses the enter key.If the user enters any character other than upper case(A-Z)alphabets program should stop taking any input
What is 'makefile' in C langauage? How it be useful? How to write a makefile to a particular program?
Can we increase size of array in c?
What the different types of arrays in c?
Why we use break in c?
Can we write a program without main() function?
What is the output for the following program #include<stdio.h> main() { char a[5][5],flag; a[0][0]='A'; flag=((a==*a)&&(*a==a[0])); printf("%d\n",flag); }
how to print the character with maximum occurence and print that number of occurence too in a string given ?
What is array of pointers to string?
Which is more efficient, a switch statement or an if else chain?
The difference between printf and fprintf is ?
what is c programming?