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

Which is the best sort method for library management?

1 Answers   Microsoft,


How the processor registers can be used in C ?

7 Answers   HP,


how to reverse string "Hello World" by using pointers only. Without any temp var

1 Answers  


What is the basic structure of c?

0 Answers  


How main function is called in c?

0 Answers  


How can you pass an array to a function by value?

0 Answers  


Is it acceptable to declare/define a variable in a c header?

0 Answers  


Write code for initializing one dimentional and two dimentional array in a C Program?

5 Answers   Deshaw, Edutech, GMD,


FILE PROGRAMMING

0 Answers   Wipro,


Write a code on reverse string and its complexity.

0 Answers   Expedia,


what is the difference b/w NULL and null?

3 Answers   HSBC, IBM,


What is the use of function in c?

0 Answers  


Categories