Learn C ProgrammingLearn ProgrammingLoop Control StructuresPrograms On Loop Control Structures While And Do-WhileResources 029. Write a Program to accept a number and print the number in reverse order. E.g. if 1324 is the number then the output will be 4231 in C language #include<stdio.h> #include<conio.h> main() { int rem,n; clrscr(); printf("Enter n : "); scanf("%d",&n); while(n>0) { rem=n%10;…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingLoop Control StructuresPrograms On Loop Control Structures While And Do-WhileResources 028. Write a Program to print first n odd numbers in C language #include<stdio.h> void main() { int i=1,n,counter=1; printf("Enter n : "); scanf("%d",&n); while(iPrashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingLoop Control StructuresPrograms On Loop Control Structures While And Do-WhileResources 027. Write a Program to print first n even numbers in C language #include<stdio.h> void main() { int i=1,n,counter=2; printf("Enter n : "); scanf("%d",&n); while(iPrashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingLoop Control StructuresPrograms On Loop Control Structures While And Do-WhileResources 026. Write a Program to print numbers n to 1 using Do While loop in C language #include<stdio.h> #include<conio.h> main() { int i=1,n; clrscr(); printf("Enter n : "); scanf("%d",&n); i=n; do {…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingLoop Control StructuresPrograms On Loop Control Structures While And Do-WhileResources 025. Write a Program to print numbers 1 to n using while loop in C language #include<stdio.h> #include<conio.h> main() { int i=1,n; clrscr(); printf("Enter n : "); scanf("%d",&n); while(iPrashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On Decision Control StructuresResources 024. Write a Program to accept user’s marital status, gender and age to check if he/she is eligible for marriage or not. #include<stdio.h> #include<conio.h> main() { int age; char MaritalStatus,Gender; clrscr(); printf("Enter MaritalStatus, Gender, Age : (e.g.…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On Decision Control StructuresResources 023. Write a program to accept roll number ,and marks for three subjects, print total marks and average, also print grade by considering following conditions Avg>=60 Grade A Avg=50 Grade B Avg=40 Grade C Grade F. #include<stdio.h> #include<conio.h> main() {…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On Decision Control StructuresResources 022. Write a program to calculate roots of a quadratic equations in C language x=b^2-4ac if x=0 -> only one root , if x>0 -> roots are distinct (–b+x)/2a…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On Decision Control StructuresResources 021. Write a program to accept three numbers from user and print them in ascending and descending order in C language #include<stdio.h> void main() { int a,b,c; printf("Enter numbers..."); scanf("%d%d%d",&a,&b,&c); if((a>=b)&&(a>=c)) { if(b>=c) { printf("\n Descending…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On Decision Control StructuresResources 020. Write a program to accept two numbers from user and compare them in C language #include<stdio.h> #include<conio.h> main() { int a,b; clrscr(); printf("Enter numbers..."); scanf("%d%d",&a,&b); if(a>b) printf("a is greater than…Prashant ChaudhariSeptember 18, 2012