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 |
why r u join this company? give solid resons.
16 Answers IBM, Infosys, TCS,
write a program to convert a expression in polish notation (postfix) to inline (normal)
What are global variables and how do you declare them?
What oops means?
Is exit(status) truly equivalent to returning the same status from main?
What are the scope of static variables?
What is difference between structure and union?
write a c program to find largest of three numbers using simple if only for one time.
Describe the steps to insert data into a singly linked list.
What is binary tree in c?
What is the stack in c?
What is a constant and types of constants in c?