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 |
How can you find the day of the week given the date?
What's the difference between a linked list and an array?
What is the output of below code? main() { static in a=5; printf("%3d",a--); if(a) main(); }
What are the different types of C instructions?
What is ctrl c called?
Describe the modifier in c?
Is printf a keyword?
why we need function pointers?
write a c program to store and print name,address,roll.no of a student using structures?
#define MAX 3 main() { printf("MAX = %d \n",MAX ); #undef MAX #ifdef MAX printf("Vector Instituteā); #endif
Is python a c language?
Write a program to print all permutations of a given string.