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 |
Can an array be an Ivalue?
What is openmp in c?
What is file in c preprocessor?
What is wrong with this initialization?
Why cann't whole array can be passed to function as value.
progrem to generate the following series 1 12 123 1234 12345
Write a program to generate prime factors of a given integer?
What is structure in c definition?
What does 3 periods mean in texting?
how can you print&scan anything using just one character? :) HINT: printf,scanf similer
How do you convert strings to numbers in C?
Write a program that accepts a string where multiple spaces are given in between the words. Print the string ignoring the multiple spaces. Example: Input: “ We Are Student “ Output: "We Are Student"