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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you declare an array of three function pointers where each function receives two ints and returns a float?

1362


What is calloc malloc realloc in c?

1055


What is putchar() function?

1151


What does the c preprocessor do?

1103


What are actual arguments?

1083


What is the difference between declaring a variable and defining a variable?

1270


What is substring in c?

1201


What is break statement?

1120


What do you mean by recursion in c?

1104


what do u mean by Direct access files? then can u explain about Direct Access Files?

2087


What do you mean by keywords in c?

1144


In a switch statement, what will happen if a break statement is omitted?

1059


what is the different bitween abap and abap-hr?

2315


How do I convert a string to all upper or lower case?

1105


What is the explanation for cyclic nature of data types in c?

1207