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 |
Wt are the Buses in C Language
Who invented b language?
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
What does extern mean in a function declaration?
What are advantages and disadvantages of recursive calling ?
12 Answers College School Exams Tests, Evolving Systems, HP, Jyoti Ltd, Sage, Wipro,
Explain how do you print only part of a string?
How can I read a directory in a C program?
2 Answers Bright Outdoor, Wipro,
which of the function operator cannot be over loaded a) <= b)?: c)== d)*
10 Answers Cisco, CTS, Google, HCL, HP,
What is string constants?
What is the use of void pointer and null pointer in c language?
Explain b+ tree?
5) Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.without using big int and exponential function