Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Write a c program using for loop in switch case?



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

Post New Answer

More C Interview Questions

What is the collection of communication lines and routers called?

0 Answers  


What are the 5 organizational structures?

0 Answers  


what is the function of .h in #include<stdio.h> in c ?

23 Answers   HCL, IBM, Wipro,


Here is a neat trick for checking whether two strings are equal

0 Answers  


Why do we use & in c?

0 Answers  


Explain modulus operator. What are the restrictions of a modulus operator?

0 Answers  


List some of the static data structures in C?

0 Answers  


void main() { int a=1; while(a++<=1) while(a++<=2); }

4 Answers   HCL,


please give code for this 1 2 4 7 11 16

11 Answers   Intel, Wipro,


When should the register modifier be used? Does it really help?

0 Answers  


Explain the meaning of keyword 'extern' in a function declaration.

0 Answers  


what is the difference between exit() and _exit() functions?

2 Answers  


Categories