Tag Archives: count

An Assembly Language program to count number of alphabets are same – IGNOU MCA Assignment 2014-15

MASTER OF COMPUTER APPLICATIONS Course Code : MCS-012 Course Title : Computer Organisation and Assembly Language Programming Assignment Number : MCA(1)/012/Assign/2014-15 Maximum Marks : 100 Weightage : 25%   Write a program in 8086 assembly Language (with proper comments) to count the number of those alphabets that are same as well as are at the… Read More »

Write a program to count the number of characters and words in a given file. 10m Jun2007

Write a program to count the number of characters and words in a given file. 10m Jun2007  #include<stdio.h> #include<process.h> void main() { FILE *fp; int chr=0,wrd=1,str; clrscr(); if((fp=fopen(“test.txt”,”r”))== NULL) { printf(“File does not exist\n”); exit(0); } while(!(feof(fp))) { str=fgetc(fp); if(str==’ ‘) wrd++; chr++; } printf(“The number of characters in file :%d\n”,chr); printf(“The number of words… Read More »

Using pointers, write a program in ‘C’ to count the occurrence of each character in a given string. 10m Dec2006

Using pointers, write a program in ‘C’ to count the occurrence of each character in a given string. 10m Dec2006   #include <stdio.h> #include <string.h> void main() { char string[100],*ptr; int c=0,count[26]={0}; clrscr(); printf(“Enter a string\n”); gets(string); ptr=string[0]; while (*ptr) { /* Consider characters from ‘a’ to ‘z’ only */ if ( ptr >= ‘a’… Read More »

C024 A C program to count number of vowels, consonants & spaces in a given string

Let’s identify variables needed for this program. In this program, we need several variables to store large sentence and count the number of occurrences in the given sentence. First variable will be the one which will save the sentence given and it will be S[]. Keeping the square bracket blank means it will take the… Read More »