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 |
Which is the best sort method for library management?
How the processor registers can be used in C ?
how to reverse string "Hello World" by using pointers only. Without any temp var
What is the basic structure of c?
How main function is called in c?
How can you pass an array to a function by value?
Is it acceptable to declare/define a variable in a c header?
Write code for initializing one dimentional and two dimentional array in a C Program?
5 Answers Deshaw, Edutech, GMD,
FILE PROGRAMMING
Write a code on reverse string and its complexity.
what is the difference b/w NULL and null?
What is the use of function in c?