Write All C Programs Using Command Line Argument-3
The document provides 91 problems to solve using C programming with command line arguments. The problems cover a wide range of topics including arithmetic operations, data types, strings, arrays, structures, file handling, recursion, and algorithms like searching, sorting, and prime number checks. The solutions are to output the result to stdout without additional text.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
26 views
Write All C Programs Using Command Line Argument-3
The document provides 91 problems to solve using C programming with command line arguments. The problems cover a wide range of topics including arithmetic operations, data types, strings, arrays, structures, file handling, recursion, and algorithms like searching, sorting, and prime number checks. The solutions are to output the result to stdout without additional text.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
Write all c programs using Command line argument.
Write the output to stdout WITHOUT
any other additional text. You may assume that the input integer will be such that the output will not exceed the largest possible integer that can be stored in an int type variable.
1. C program to add two integers.
Normal method. Using Recursion. 2. C program to multiply two floating point numbers. Normal method. Using Recursion. 3. C program to find ASCII value of a character. 4. C program to compute quotient and remainder. 5. C program to find size of int, float, double and char. 6. C program to demonstrate the work of keyword long. 7. C program to swap two numbers. Using third variable. Without using third variable. 8. C program to check whether a number is even or odd. 9. C program to check whether a Character is Vowel or consonant. 10. C program to find largest among 3 numbers. Using if-else Using ternary operator. 11. C program to find all roots of quadratic equation. 12. C program to check leap year. 13. C program to check whether number is positive or negative. 14. C program to check whether a character is alphabet or not. 15. C program to calculate sum of natural numbers up to a certain number. Using recursion. Also count the number of even numbers and odd numbers. 16. C program to find factorial of a number.(IEM TCS-2017) Using iterative method. Using recursion. 17. C program to generate multiplication table of a number. 18. C program to display Fibonacci sequence. Upto a certain number Upto N terms. 19. C program to find GCD and LCM of 2 numbers. 3 numbers. N numbers. 20. C program to find GCD using recursion. 21. C program to display characters from A to Z using loop. 22. C program to count no of digits in an integer. 23. C program to reverse a number. 24. C program to calculate power of a number. Using recursion. 25. C program to check whether a number is palindrome or not. 26. C program to check whether a number is prime or not. 27. C program to display prime numbers between two intervals and their sum.(IEM TCS-2017) 28. C program to display factors of a number and check if that number is a Perfect Number or not.(A perfect number is a positive number that equals the sum of its divisors, excluding itself. For eg: 6=1+2+3, 28=1+2+4+7+14,496=1+2+4+8+16+31+62+124+248.) 29. C program to display perfect numbers between two intervals. 30. C program to check if a number is an Armstrong number or not. (An Armstrong number is an n-digit number that is equal to the sum of the nth powers of its digits. For eg: 61 = 6, 13+53+33=153and 14 + 64 + 34 + 44=1634.) 31. C program to display Armstrong numbers between two intervals. 32. C program to make a simple calculator using switch case. 33. C program to display prime numbers between two intervals using function. 34. C program to check prime number or Armstrong number using user defined function. 35. C program to check a whether a number can be expressed as sum of 2 primes. (For Eg:7=2+5, 9=2+7, 52=23+29) 36. C program to check if two numbers are coprime or not. (In number theory, two integers a and b are said to be relatively prime, mutually prime, or coprime (also written co-prime) if the only positive integer (factor) that divides both of them is 1. This is equivalent to their greatest common divisor being 1. For eg: 7 & 8, 9 & 10,13 & 14) 37. C program to check if two numbers are twin prime or not. (A twin prime is a prime number that is either 2 less or 2 more than another prime number—for example, either member of the twin prime pair (41, 43). In other words, atwin prime is a prime that has a prime gap of two.) 38. C program to convert a binary number to decimal number and vice versa.(IEM TCS-2017) 39. C program to convert an octal number to decimal number and vice versa. 40. C program to convertan octal number to binarynumber and vice versa. 41. C program to reverse a sentence using recursion. 42. C program to calculate average of elements of an array. 43. C program to find largest element of an array. 44. C program to search an element in an array. Using Linear Search. Using Binary Search. 45. C program to search the majority element in an array. 46. C program to sort an array. 47. C program to reverse an array. 48. C program to find theunion of two arrays. 49. C program to find theintersection of two arrays. 50. C program to find duplicate elements in an array. 51. C program for Equilibrium index of an array. (Equilibrium index of an array is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes. For example, in an array A: A[0] = -7, A[1] = 1, A[2]=5,A[3] = 2, A[4] = -4, A[5] = 3, A[6]=0,3 is an equilibrium index, because:A[0] + A[1] + A[2] = A[4] + A[5] + A[6],6 is also an equilibrium index, because sum of zero elements is zero, i.e., A[0] + A[1] + A[2] + A[3] + A[4] + A[5]=0) 52. C program for Next Greater Element. (The Next greater Element for an element x is the first greater element on the right side of x in array. Elements for which no greater element exist, consider next greater element as -1.For eg: If A= {11, 13, 21, 3} output is {13, 21,-1,-1}.) 53. C program to count the number of occurrences in a sorted array. 54. C program to sort an array using Bubble Sort Selection Sort Insertion Sort. 55. C program to calculate Standard Deviation. 56. C Program to check if two given matrices are identical. 57. C program to add 2 matrices using multi-dimensional arrays. 58. C program to multiply 2 matrices using multi-dimensional arrays. 59. C program to multiply 2 matrices passing matrices to a function. 60. C program to find the transpose of a matrix. 61. C program to access elements of an array using pointers. 62. C program to swap numbers in a cyclic fashion using call by reference. 63. C program to find largest number using Dynamic Memory Allocation. 64. C program to find frequency of a character in a string. 65. C program to count number of vowels, consonant, digits and special characters in a string. 66. C program to remove all character in a string except alphabets. 67. C program to find length of a string. 68. C program to concatenate two strings. 69. C program to copy string without using strcpy(). 70. C program to swap two Strings. 71. C Program to check if a given string is palindrome. 72. C Program to sort an array of names or strings. 73. C program toreturn maximum occurring character in the input string. 74. C program toremove all duplicates from the input string. 75. C program toprint all the duplicates in the input string. 76. C program to remove characters from the first string which are present in the second string. 77. C program to print reverse of a string using recursion. 78. C program to sort elements in lexicographical order. 79. C program to store information (name, roll, marks) of a student using structure. 80. C program to add two distances (in feet-inch) system using structure. 81. C program toadd two complex numbers by passing structure to a function. 82. C program to calculate difference between two time periods. 83. C program to store information of students using structure. 84. C program to store information of students using structure using Dynamic Memory Allocation. 85. C program to write a sentence in a file. 86. C program to read a line from a file and display it. 87. C program to display its own source code as output. 88. C Program to find sum of series 1 + 1/2 + 1/3 + 1/4 +... + 1/n. 89. Determine a number whether it is prime or not and if that number is prime then print the sqrt of the number to 2 decimal places otherwise print 0.00.(IEM TCS-2017) 90. C program to create pyramid and pattern. * A *** BB ***** CCC ******* DDDD ********* EEEEE 91. C program to create Pyramid a and structure. 1 1 2 3 12 4 5 6 123 7 8 9 10 1234